$BBh(B 9 $B2s(B $B2sO)%7%_%e%l!<%?(B, $B7+$jJV$7J8(B

$BK\F|$NFbMF(B


$B$3$N%I%-%e%a%s%H$O(B http://edu.net.c.dendai.ac.jp/ $B>e$G8x3+$5$l$F$$$^$9!#(B

9-1. Circuit Maker

$BEE5$2sO)(B

$B1i=,(B9-1

$B $B%R%s%H(B
  1. $B!V(BDevices$B"*(BBrowse... x$B!W(B $B$GItIJ$N0lMw$rI=<($9$k2hLL$K$7!"(B Major Device Class $B$+$i(B Resistors $B$rA*Br$7$^$9!#(B Minor Device Class $B$+$i(B Resistors $B$rA*Br$7$^$9!#(B Device Symbol $B$+$i(B Resistor $B$rA*Br$7$^$9!#(B ($B0J8e!"$3$NA`:n$r(B Major Device Class, Minor Device Class, Device Symbol $B$N=g$K(B (Resistors, Resistors, Resistor)$B$H=q$-$^$9(B)
    $BItIJ$NA*Br2hLL(B

    $B!V(BPlace$B!W%\%?%s$r2!$9$H!":n6HNN0h$K2hLL$,@Z$jBX$o$j$^$9!#(B $BGr$$2hLL$NCf1{IU6a$r:8%/%j%C%/$9$k$H!"Dq93$rI=$95-9f$,I=<($5$l$^$9!#(B

    $BDq93(B

    $BDq93$N5-9f$r;X$7$F1&%/%j%C%/$7$F!V(BDuplicate$B!W$rA*Br$9$k!#(B $B$=$7$F9g7W(B 3 $BK\$NDq93$rG[CV$7$^$9!#(B $BDq935-9f$r1&%/%j%C%/$7$F!V(BEdit Device Data$B!W$rA*$S$^$9!#(B $B!V(BLabel-Value$B!W$H$$$&Ms$,Dq93CM$rI=$7$^$9$N$G!"$3$3$GDq93CM$r;XDj$7$^(B $B$9!#(B

  2. $BItIJI=$+$i(B (Analog, Instruments, Multimeter) $B$rA*$S(B $B!V(BPlace$B!W%\(B $B%?%s$rA*$SE,Ev$J0LCV$G:8%/%j%C%/$7$^$9!#(B $B$9$k$H!"%a!<%?$N
    $B%a!<%?A*Br?^(B
  3. $B%7%_%e%l!<%7%g%s$NET9g>e!"4p=`$H$J$k(B 0 V $B$NE@$,I,MW$J$N$G!"(B(Analog, Power, Ground) $B$rG[CV$7$^$9!#(B
  4. $B!V(BOptions$B"*(BArrow/Wire$B!W$rA*$S!"ItIJ$NC $B40@.?^(B
  5. $B!V(BSimulation$B!W$r2!$7$F!"(B $B!V(BAnalog Mode$B!W$HI=<($5$l$F$$$k$3$H$r3NG'$7$^$9!#(B $B$b$7!"!V(BDigital Mode$B!W$,I=<($5$l$F$$$k;~$O!"$3$N!V(BDigital Mode$B!W$rA*Br(B $B$9$k$H!V(BAnalog Mode$B!W$K$J$j$^$9!#(B
  6. $B!V(BSimulation $B"*(B Run$B!W$rA*[email protected]$,I=<($5$l$^$9!#(B

$B1i=,(B9-2

$B2<$N2sO)?^$G(B1$B&8$NDq93$rN.$l$kEEN.$NBg$-$5$r5a$a$J$5$$!#(B

$B%R%s%H(B

$BEECS$O(B(Anarog, Power, Battery)$B!#(B $BEEN.$rB,Dj$9$k$K$O%^%k%A%a!<%?$G(B current $B$r;XDj$7$^$9!#(B $B40@.?^$O


$BEE;R2sO)(B

$B1i=,(B9-3

$B2<$N2sO)?^$G!"(BA $BE@$H(B B $BE@$NEE05$rD4$Y!"A}I}N($r5a$a$J$5$$!#(B

$B%R%s%H(B
  1. $BItIJ$rG[CV$7$F2sO)?^$r:n@.$7$^$9!#(B $B%H%i%s%8%9%?$O(B(Transistors, BJTs, NPN TransB) $B$rA*$S!"2<$N%b%G%kA*Br2h(B $BLL$+$i!V(B2N2222A$B!W$rA*$S$^$9!#(B

    1kHz $B$rF~NO$9$k$K$O!"(B(Analog, Instruments, Signal Gen) $B$rA*$S$^$9!#(B $BEE05$NI}$rF~NO$9$k$K$O!"(BSignal Gen $B$N5-9f$r1&%/%j%C%/$7!"!V(BEdit Signal Generator$B!W$rA*$S$^$9!#$=$7$F!"!V(BPeak Amplitude$B!W$NMs$K(B 100mV $B$rF~NO$7$^$9!#(B

  2. $B!V(BSimulation $B"*(B Run$B!W$rA*$S!"%7%_%e%l!<%7%g%s$r3+;O$7$^$9!#(B
  3. $BEE05$rB,$j$?$$E@$r:8%/%j%C%/$9$k$H!"2hLL2<$K4QB,$5$l$?CM$,%0%i%U$G(B $BI=<($5$l$^$9!#(B $BJL$NE@$r!V(BShift$B!W%-!<$r2!$7$J$,$i:8%/%j%C%/$9$k$H!"%0%i%U$,=E$J$C$FI=(B $B<($5$l$^$9!#(B
  4. $B%0%i%U$N1&B&$K%+!<%=%k$,$"$j$^$9$N$G!"$=$l$r0\F0$7$F%0%i%U$NCM$rFI$_$H(B $B$j!"=PNOEE0L:9$r7WB,$7$^$9!#(B

$B1i=,(B9-4

$B2<$N2sO)?^$G!"(BA $BE@$H(B B $BE@$NEE05$rD4$Y!"A}I}N($r5a$a$J$5$$!#(B


$B;29MJ88%(B

$BNkLZ2m?C!V

$B%G%#%8%?%k2sO)(B

$B1i=,(B9-5

$BFs?J?t0l7e(B($B$D$^$j(B 0 $B$+(B 1)$B$rFs$DF~NO$7$F!"B-$7;;$r
xyz1z0
0000
0101
1001
1110

$B%R%s%H(B
  1. $BH>2C;;4o$N2sO)$OEX-OR(Exclusive OR, X-OR, $BGSB>E*O@M}OB(B)$B$H8@$$$^$9!#(B
  2. (Digital Basics, Gates, 2-In AND) $B$H(B (Digital Basics, Gates, 2-In XOR) $B$rG[CV$7$^$9!#(B $B=PNO$K(B (Digital Animated, Displays, Logic Display) $B$rFs$D!"F~NOMQ$K(B (Digital, Power, Logic Switch) $B$rFs$DG[CV$7$^$9!#(B
  3. $B2sO)$rG[@~$7$^$9!#40@.?^$O
  4. $B!V(BSimulation$B!W$r2!$7$F!"(B $B!V(BDigital Mode$B!W$HI=<($5$l$F$$$k$3$H$r3NG'$7$^$9!#(B $B$b$7!"!V(BAnalog Mode$B!W$,I=<($5$l$F$$$k;~$O!"$3$N!V(BAnalog Mode$B!W$rA*Br(B $B$9$k$H!V(BDigital Mode$B!W$K$J$j$^$9!#(B
  5. $B!V(BSimulation $B"*(B Run$B!W$rA*$S$^$9!#(B $B%9%$%C%A$rF~$j@Z$j$9$k$H!"$=$l$K1~$8$F%9%$%C%A$NCM$NOB$KBP1~$9$k%i%s%W(B $B$,8w$j$^$9!#(B

$B1i=,(B9-6

$B0J2<$K<($9A42C;;4o$rMxMQ$7$F!"Fs?J?tFs7e$rFs$DF~NO$9$kB-$7;;2sO)$r:n$j(B $B$J$5$$!#(B $BA42C;;4o$H$O(B 3 $B$D$N0l7e$NFs?J?t$NF~NO$NOB$rFs7e$NFs?J?t$H$7$F=PNO$9$k(B $B$b$N$G$9!#(B

$B??M}CMI=$O
xycz1z0
00000
01001
10001
11010
00101
01110
10110
11111

$B%R%s%H(B
  1. $BI.;;$HF1$8MWNN$G2<$N7e$+$i=g$KB-$7$F$$$-$^$9!#(B $B$=$N;~7+$j>e$,$j$N=hM}$b$7$^$9!#(B $B$D$^$j!" $BB-$7;;4o$N35G0?^(B
  2. $B:G2<0L7e$OH>2C;;4o$G7W;;$7$^$9!#(B $B$=$7$F!"2<$N7e$N7+$j>e$,$j$H!"$=$N7e$NFs$D$N?t$N9g$o$;$F;0$D$N?t$NB-$7(B $B;;$rA42C;;4o$G9T$$$^$9!#(B
  3. $BI=<($K(B Logic Display $B$r;H$&Be$o$j$K!"(B (Digital Animated, Displays, Hex Display) $B$b;H$($^$9!#(B

9-2. $B7+$jJV$7(B

while$BJ8(B

C $B8@8l$G$b$C$H$b4pK\E*$J7+$jJV$7J8$O(B while $BJ8$G$9!#(B while $BJ8$O

while($B>r7o<0(B){
  $B7+$jJV$7J8(B
}

$B>r7o<0$,@5$7$$8B$j7+JV$7J8$rr7o<0$,@.N)$7$J$1$l$P7+JV$7J8$O0l2s$br7o<0$,@.N)$9$k$H7+JV$7J8$,r7o(B $B<0$,JQ$o$i$J$$$H1J1s$K7+$jJV$7$,5/$-$F$7$^$$$^$9!#(B if $BJ8$H0c$&E@$O!"(B if $BJ8$G$O>r7oJ8$NCf?H$rJQ2=$5$;$k$3$H$K0U<1$r$9$kI,(B $BMW$,$J$$$N$K$b$+$+$o$i$:!"(B while $BJ8$G$O>r7o<0$r7+$jJV$7$F$$$k4VCf8+$F(B $B$$$F!"7+$jJV$7$F$$$k4V$O>[email protected])$7!"7+$jJV$7$r=*$($k;~$K>r7o$,[email protected])$K(B $B$J$k$h$&$K$7$J$1$l$P$J$i$J$$$3$H$G$9!#(B $B$=$3$G!"7+$jJV$7$N4pK\E*$J%F%/%K%C%/$H$7$F!"

  1. $B>r7o<0$NCf$K8=$l$k!#(B
  2. $B7+JV$7J8$NCf$GCM$,JQ99$5$l$k!#(B

$B$3$N$h$&$JJQ?t$N$3$H$r(B$B%k!<%WJQ?t(B$B$H8@$$$^$9!#(B

$BNc$($P!"(B 5 $B2s$@$17+$jJV$9$3$H$r9M$($^$9!#$=$N;~!"%k!<%WJQ?t$NLr3d$O!"(B $B7+$jJV$7$N2s?t$r?t$($k$3$H$G$9!#(B $B$=$N$?$a$K$O!"7+$jJV$7$NCf$G7+$jJV$5$l$k$?$S$K%k!<%WJQ?t$,(B 1 $B$:$DA}$((B $B$kI,MW$,$"$j$^$9!#(B $B$3$l$K$O

$B%k!<%WJQ?t(B = $B%k!<%WJQ?t(B + 1;

$B$3$N$h$&$K$9$k$H$3$N<0$rr7o<0$G%k!<%WJQ?t$NCM$r4F;k$9$k$h$&$K$9$k$H!"(B 5 $B2s=hM}$r7+$jJV$9$3(B $B$H$,$G$-$k$h$&$K$J$j$^$9!#(B

$B%k!<%WJQ?t(B = 1;
while($B%k!<%WJQ?t(B <= 5){
  $B=hM}(B;
  $B%k!<%WJQ?t(B = $B%k!<%WJQ?t(B +1;
}

$B$3$l$r

  1. $B%k!<%WJQ?t(B = 1
  2. while $B>[email protected])(B
  3. $B=hM}(B
  4. $B%k!<%WJQ?t(B = 1+1 = 2
  5. while $B>[email protected])(B
  6. $B=hM}(B
  7. $B%k!<%WJQ?t(B = 2+1 = 3
  8. while $B>[email protected])(B
  9. $B=hM}(B
  10. $B%k!<%WJQ?t(B = 3+1 = 4
  11. while $B>[email protected])(B
  12. $B=hM}(B
  13. $B%k!<%WJQ?t(B = 4+1 = 5
  14. while $B>[email protected])(B
  15. $B=hM}(B
  16. $B%k!<%WJQ?t(B = 5+1 = 6
  17. while $B>[email protected])(B
  18. $B=*N;(B

$B$3$l$K$h$j=hM}$,(B 5 $B2s9T$o$l$?$3$H$,$o$+$k$H;W$$$^$9!#(B

$B1i=,(B9-7

$B

#include <stdio.h>
main(){
  int a;
  a=0;
  while(a<5){
    printf("$B!{(B");
    a=a+1;
  }
  printf("\n");
}

$B!V(Ba=a+1$B!W$H$$$&5-K!$O!"!Vi+1=ai+1 $B$HF1$8Lr3d$K$J$j$^$9!#(B $B;O$a$K!V(Ba=0$B!W$H$7$F$*$$$F!"!V(Ba=a+1$B!W$r7+$jJV$9$H!"!V(Ba=a+1$B!W$r7+$jJV$7$?2s?t(B $B$@$1(B a $B$,A}$($F$$$-$^$9!#7+$jJV$72s?t$r(B i $B$H$9$k$H!"(B a $B$NCM$O(B i $B$K$J$j$^$9!#(B

$B1i=,(B9-8

$B2<$N%W%m%0%i%`$rAv$i$;$J$5$$!#(B $B$^$?!"$3$N%W%m%0%i%`$r2~B$$7!"%k!<%WJQ(B $B?t$NCM$,0J2<$N$h$&$K$J$k$h$&$K$7$J$5$$!#(B

  1. 1, 3, 5, 7, 9
  2. 10, 9, 8, 7, 6
#include <stdio.h>
main(){
  int b;
  b=2;
  while(b<=10){
    printf("$B%k!<%WJQ?t(B = %d\n",b);
    b=b+2;
  }
}

$B0lJ}!"%k!<%WJQ?t$r;HMQ$7$F?tNs$N0lHL9`$r=q$/$H!"?tNs$rI=<($9$k$3(B $B$H$,$G$-$^$9!#(B

$B1i=,(B9-9

$B2<$N%W%m%0%i%`$rAv$i$;$J$5$$!#(B $B$^$?!"$3$N%W%m%0%i%`$r2~B$$7$F!"M5$N$"$k(B $B?M$O:G8e$N%+%s%^!V(B,$B!W$,=P$J$$$h$&$K$7$J$5$$(B)$B!#(B

  1. 1, 3, 5, 7, 9, ... 19
  2. 10, 9, 8, ... , -10
  3. 1, 2, 4, 8, 16, ... 1024
#include <stdio.h>
main(){
  int i,b;
  i=0;
  while(i<10){
    b=2*(i+1);
    printf("%d, ",b);
    i=i+1;
  }
  printf("\n");
}

$B1i=,(B9-10

$B0J2<$N;03Q4X?t$NI=$r=PNO$9$k%W%m%0%i%`$r40@.$5$;$J$5$$!#(B

#include <stdio.h>
#include <math.h>
main(){
  int i;
  float x,y;
  i=0;
  while(i<20){
    x = /* x $B$NCM$O(B 0 $B$+$i(B 2$B&P$N4V(B $B$r$H$k$h$&$K$9$k!#(B */
    y = /* sin x $B$NCM$rF~$l$k(B */
    printf("x=%f, sin(x)=%f\n",x,y)
    /* i $B$NCM$r99?7$9$k(B */
  }
}

$B1i=,(B9-11

$B%U%#%\%J%C%A?tNs$r(B(20$B8D(B)$BI=<($9$k%W%m%0%i%`$r=q$-$J$5$$!#(B $BC"$7!"%U%#%\%J%C%A?tNs$H$O

1, 1, 2, 3, 5, 8, 13, 21, 34, 53, ...

a0=1
a1=1
ai=ai-1+ai-2 (i$B!f(B2)

C $B8@8l$NFHFC$N5-K!(B(1)$B<0$NCM(B

C $B8@8l$G$OA4$F$NJ8$d<0$KCM$r;}$A$^$9!#(B $BNc$($PBeF~J8$OBeF~$7$??t$rCM$K;}$A$^$9!#(B j=0 $B$H$$$&BeF~J8$NCM$O(B 0 $B$G$9!#(B $B=>$C$F

i=j=0

$B$3$N>l9g!"!V(Bj=0$B!W(B $B$K$h$j(B j $B$K(B 0 $B$,BeF~$5$l$^$9$,!"!V(Bj=0$B!W$N<0$NCM$O(B 0 $B$J$N$G!"(B i $B$K$O$3$N<0$NCM(B 0 $B$,BeF~$5$l$^$9!#(B

$B>r7oJ8$N<0$NCM$O!"??$G$"$l$P(B 1$B!"56$G$"$l$P(B 0 $B$G$9!#=>$C$F!"(B0==0 $B$O(B 1$B!"(B 1==0 $B$O(B 0 $B$NCM$r;}$A$^$9!#0lJ}!">r7oJ8$G$O!"(B 0 $B$J$i56!"(B0 $B0J30$NCM$J$i(B $B??$@$HH=Dj$7$^$9!#$7$?$,$C$F!"

if(x!=0){}
if(x){}

$B1i=,(B9-12

$B

  1. i=(j=1)+1;
  2. i=((j=0)==0);
  3. if(i){i=0;}

C $B8@8l$NFHFC$N5-K!(B(2)$BBeF~1i;;;R(B

$B%W%m%0%i%_%s%0$G$O(B i=i+1 $B$J$I!"$b$H$b$HJQ?t$KF~$C$F$$$kCM$r(B $B!VA}$d$9!W$J$IJQ2=$5$;$kA`:n$,(B $BB?$$$G$9!#$=$N$?$a!"$3$l$r(B i+=1 $B$H=q$/$3$H$b$G$-$k$h$&$K$J$C$F$^$9!#(B $B$3$l$r(B$BBeF~1i;;;R(B$B$H8@$$$^$9!#(B $B$^$?!"FC$K(B 1 $B$rB-$7$?$j0z$$$?$j$9$k$3$H$,B?$$$N$G!"FCJL$K(B 1 $BA}$d$9$N$r(B ++i$B!"(B 1 $B8:$i$9$N$r(B --i $B$H=q$/$3$H$,$G$-$^$9!#(B $B$3$l$i$N$=$l$>$l$N<0$NCM$O!"7W;;7k2L$NJQ?t$NCM$K$J$j$^$9!#(B $B0lJ}$G!"(Bi++, i-- $B$OJQ?t$NCM$r(B1 $BA}$d$7$?$j8:$i$7$?$j(B $B$9$k:]$K!"<0$NCM$OA}8:$5$;$kA0$NJQ?t$NCM$K$J$j$^$9!#(B $B$^$?!"(B 2 $B8:$i$9$N$O(B i-=2$B!"(B 5 $BG\$9$k$K$O(B i*=5 $B$H=q$-$^$9!#(B

$B1i=,(B9-13

$B

#include <stdio.h>
main(){
  int i,j;
  printf("i=0 $B$G(B i $B$K(B 1 $B$rA}$d$9(B\n");
  i=0;j=(i=i+1);printf("i $B$NCM(B %d, $B<0$NCM(B %d\n",i,j);
  i=0;j=(i+=1);printf("i $B$NCM(B %d, $B<0$NCM(B %d\n",i,j);
  i=0;j=(++i);printf("i $B$NCM(B %d, $B<0$NCM(B %d\n",i,j);
  i=0;j=(i++);printf("i $B$NCM(B %d, $B<0$NCM(B %d\n",i,j);
}

i++ $B$OG[NsJQ?t$N=hM}$G;H$$$^$9!#>\$7$/$O

$B1i=,(B9-14

$B

#include <stdio.h>
main(){
  int i;
  i=5;
  while(i--){
    printf("%d\n",i);
  }
}

$B1i=,(B9-15

$B$BBgI}$K(B$B2~B$$7$J$5$$!#(B

$B!|(B
$B!|!|(B
$B!|!|!|(B
$B!|!|!|!|(B
$B!|!|!|!|!|(B
$B!|!|!|!|!|!|(B
#include <stdio.h>
main(){
  int i, j;
  i=5;
  while(j=i--){
    while(j--){
      printf("$B!{(B");
    }
    printf("\n");
  }
}

for $BJ8(B

$BB>$N8@8l$G$O(B for $BJ8$OFCJL$JF0:n$r$9$k$3$H$,$"$j$^$9$,!"(B C $B8@8l$G$O(B for $BJ8$O(B while $BJ8$H$[$\F1$8$G$9!#(B $BJ8K!$O

for($B0lHV$O$8$a$K$@$1r7oJ8(B ; $B7+$jJV$7$N:G8e$K

$B$D$^$j

  1. for(A;B;C){D;}
  2. A; while(B){D; C;}

$B

for(i=0;i<10;++i){
  printf("%d\n",i);
}

$B$3$l$O

i=0;
while(i<10){
  printf("%d\n",i);
  ++i;
}

for $BJ8$G=q$/$H!"%k!<%WJQ?t$N=hM}$r0l$+=j$K$^$H$a$k$3$H$,$G$-$k$N$G!"7+(B $B$jJV$72s?t$,0lL\$G$o$+$k$J$I$NMxE@$,$"$j$^$9!#(B $B5U$K(B for $B$NCf$K%k!<%WJQ?t0J30$NJ8$rB?$/F~$l$F$7$^$&$HFI$_$E$i$/$J$j$^(B $B$9!#(B

$B1i=,(B9-16

$B$7$J$5$$!#(B $B$^$?!"(Bn $B$K(B 6, 14, 23 $B$rF~$l$F=PNO$,$I$&$J$k$+D4$Y$J$5$$!#(B $B$J$*!"7?$,(B int $BF1;N$N3d;;$O@Za%b $B$O(B a $B3d$k(B b $B$NM>$j$r0UL#$7$^$9!#(B

#include <stdio.h>
main(){
  int n;
  n=11;
  for(;n;n/=2){
    printf("%d",n%2);
  }
  printf("\n");
}
$B;29M(B

$B?t$rI=$9;~!"2<$N7e$+$iI=$9$N$r(B little endian $B$H8@$$!">e$N7e(B $B$+$iI=$9$N$r(B big endian $B$H8@$$$^$9!#(B $B?M4V$ODL>o(B big endian $B$G?t$rI=8=$7$^$9$,!"%3%s%T%e!<%?$G$O(B little endian $B$NJ}$,=hM}$KJXMx$J>l9g$b$"$j!";H$o$l$k$3$H$,$"$j$^$9!#(B Intel $B


$B1i=,(B9-17

$B$7$J$5$$!#(B $B$^$?!"(B n $B$NCM$r(B 32, 60 $B$KJQ$($F=PNO$,$I$&$J$k$+D4$Y$J$5$$!#(B $BM>M5$,$"$k?M$OLs?t$N?t$@$1I=<($9$k$h$&$K2~B$$7$J$5$$!#(B

#include <stdio.h>
main(){
  int n,i;
  n=18;
  printf("%d$B$NLs?t$O(B",n);
  i=1;
  while(i<=n){
    if(!(n%i)){
      printf(" %d",i);
    }
    i++;
  }
  printf("\n");
}

9-3. $B=IBj(B

Mupad $B$r%@%&%s%m!<%I$7$F$*$$$F2<$5$$!#(B


$B:dK\D>;V(B <[email protected]>
$BEl5~EE5!Bg3X9)3XIt>pJsDL?.9)3X2J(B