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B)$B$NF~Lg(B
    2. C $B8@8l$N9=B$7?!"%]%$%s%?!":F5"=hM}$rMxMQ$7$?%W%m%0%i%_%s%0(B
    3. $BJ#;($J%G!<%?9=B$(B

$B%W%m%0%i%_%s%08@8l(B C

C $B%3%s%Q%$%i(B gcc $B$r%$%s%9%H!<%k$9$k!#(B

  1. gcc $B$r$B$B;XDjDL$j$K?J$`$H(B c:\gcc-2.95.2 $B$K%$%s%9%H!<%k$5$l$k!#(B ($B%I%-%e%a%s%H(B($B1Q8l(B)$B$b%$%s%9%H!<%k$9$Y$7(B)

gcc $B$N;H$$J}(B

  1. MS-DOS $B%W%m%s%W%H$G;HMQ$9$k!#(B
  2. $B;HMQ$9$kA0$K0l2s$@$1(Bc:\gcc-2.95.2\mingw32 $B$rF~NO$7!"4D6-JQ?t(B($B%7%'%k$KEO$9>pJs(B)$B$r%;%C%H$9$k(B ($B3NG'J}K!(B: set $B$rF~NO$7!"I=<($K(B gcc $B$,4^$^$l$k9`L\$,$"$l$P(B OK)
  3. $BMxMQ$G$-$k%3%^%s%I(B(c:\gcc-2.95.2\bin )
    gcc:
    C $B%3%s%Q%$%i(B($B9=B$7?8@8l(B)
    g++,c++:
    C++ $B%3%s%Q%$%i(B($B%*%V%8%'%/%H;X8~8@8l(B)
    g77:
    FORTRAN $B%3%s%Q%$%i(B($Bas:
    $B%"%;%s%V%i(B
    make:
    $B%W%m%0%i%`$N3+H/;Y1g%=%U%H%&%'%"(B
    gdb:
    $B%G%P%C%,(B

$B1i=,(B2

$B

/* This program prints "Hello World!". */
#include <stdio.h>
main(){
  printf("Hello World!\n");
}
stdio.h
printf $B4X?t$rMxMQ$9$k$H$-!";XDj$,I,MW(B
$B!V(B\n$B!W(B
$B2~9T5-9f(B

$B1i=,(B3

$B$3$N%W%m%0%i%`$r

(3-1)$B$^$:!":n6H%G%#%l%/%H%j$r:n$k(B

  1. MS-DOS $B%W%m%s%W%H2hLL$r3+$/(B
  2. cd \
  3. ren d home
    ren $B$O(B rename $B%3%^%s%I!#@hF|:n@.$7$?%G%#%l%/%H%j(B d $B$r(B home $B$H$$$&L>A0$K=q$-49$($k!#(B
$B0J8e!"%G%#%l%/%H%jL>!"%U%!%$%kL>$O1Q?t;z$GI=$9!#(B $BF|K\8l$r;HMQ$9$k$H!"Hs>o$KITJX$GITET9g$,5/$-$k$N$GCm0U!#(B

(3-2)$B2<=`Hw(B

  1. c:\gcc-2.95.2\mingw32
  2. cd home
  3. edit hello.c
  4. $B%V%i%&%6$G$3$N$B;qNA(B$B$r3+$/!#(B
  5. $B%W%m%0%i%`ItJ,$r%I%i%C%0$7!"(BCtrl-C$B$G%3%T!<(B
  6. MS-DOS $B2hLL$N%a%K%e!<%P!<$NE=$jIU$1%\%?%s$G%Z!<%9%H(B
  7. $B%U%!%$%k$rJ]B8$9$k!#(B
  8. exit$B$G=*N;$9$k!#(B

(3-3)$B%3%s%Q%$%k(B

  1. gcc hello.c ($B%3%s%Q%$%k$7$F$G$-$?A0$K$J$k(B)

(3-5)$B
  1. .\a.exe

$B1i=,(B4

$B$3$N%W%m%0%i%`$r2~B$$7$F!"!V(BHello New World!$B!W$r2hLL$K=P$7$J$5$$!#(B

$B1i=,(B5

$B

/* program 1*/
#include <stdio.h>
#include <math.h>

main()
{
  float a,b,c,d,kai1,kai2,zitsubu,kyobu;
  a=2.0; b=3.0; c=1.0;
  printf(" %f x^2 + %f x + %f = 0\n",a,b,c);
  d=b*b-4*a*c;
  if(d==0){
    kai1 = -b/2/a;
    printf("root = %f\n", kai1);
  }else{
    if( d>0 ){
      kai1 = (-b + sqrt(d))/2/a; kai2 = (-b - sqrt(d))/2/a;
      printf("root1= %f, root2= %f\n",kai1,kai2);
    }else{
      zitsubu= -b/2/a; kyobu = sqrt(d)/2/a;
      printf("kai = %f +- %fi\n",zitsubu,kyobu);
    }
  }
}

$B1i=,(B6

$B$3$N%W%m%0%i%`$r%3%s%Q%$%k$7

($BCm0U(B)

$B%3%s%Q%$%k$9$k;~!"(B

gcc C$B$N%U%!%$%kL>(B -lm
$B$H!"!V(B-lm$B!W$r;XDj$9$kI,MW$,$"$k!#(B


$B:dK\D>;V(B [email protected]