$B$6$6Cn%m%4(J


$B#C8@8lF~Lg(J
Introduction of The C Programming Language

$B"%#C8@8lL\


$B!!4X?t$NDj5A$H8F$S=P$7J}(J

$B!!#C8@8l$G$O!"!V0lO"$N=hM}$N=8$^$j!W$r4X?t$H$$$$$^$9!#$?$H$($P!"$9$G$K;H$C$F$-$?(J printf()$B!"(J scanf() $B$J$I$b4X?t$G$"$j!"$3$N$h$&$K!"#C8@8l$,$"$i$+$8$aMQ0U$7$F$$$k4X?t$rI8=`%i%$%V%i%j4X?t$H$$$$$^$9!#(J $B$3$l$H$OJL$K!"%W%m%0%i%^$,FH<+$N4X?t$r:n$k$3$H$b$G$-$^$9!#(J $B$9$J$o$A!"%W%m%0%i%`$NCf$N$"$k0l2t$N=hM}$r4X?t$H$$$&C10L$KFHN)$5$;$k$3$H$,$G$-$k$N$G$9!#(J
$B!!$$$^$^$G!"(Jmain $B4X?t$K $B!!0J2<$N%W%m%0%i%`$O(J main $B4X?t$H$=$l$+$i8F$S$@$7!"(J $B

/* * main $B4X?t(J */ main() { $B!!!!(Jvoid disp_msg( void ); /* $B4X?t$N%W%m%H%?%$%W@k8@(J */ $B!!!!(Jprintf("main $B4X?t%9%?!<%H(J\n"); $B!!!!(Jdisp_msg(); /* $B4X?t$N8F$S$@$7(J */ $B!!!!(Jprintf("main $B4X?t$KLa$C$F$-$?(J\n"); } /* * disp_msg $B4X?t(J */ void disp_msg( void ) { $B!!!!(Jprintf("disp_msg $B4X?t<B9T(J\n"); }

$B%W%m%0%i%`$H8@MU$N@bL@(J
main() $B%W%m%0%i%`$NF~$j8}(J
main $B4X?t$H8F$V(J
void disp_msg( void ); $B4X?t$N%W%m%H%?%$%W@k8@(J
$B:G=i$N(J void $B$N0UL#$O!"4X?t$N disp_msg $B$O!"4X?t$NL>A0(J
$B4X?tL>$N8e$N(J ( ) $BFb$N(J void $B$N0UL#$O!"4X?t$KEO$90z?t$,$J$$$3$H$r$7$a$9(J
disp_msg(); $B4X?t$N8F$S$@$7!"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$^$9!#(J
$B!|!!4X?t$N%W%m%H%?%$%W@k8@(J $B!Z=q<0![(J$B!!!!La$jCM$N%G!<%?7?!!4X?tL>(J( $B%G!<%?7?!!0z?t(J1, $B%G!<%?7?!!0z?t(J2,$B!D(J );

$B%W%m%H%?%$%W@k8@$O!"JQ?t$HF1MM$K%V%m%C%/$N@hF,$G9T$&(J
$B!|!!4X?t$N8F$S$@$7(J $B!Z=q<0(J1$B![(J$B!!(J $BJQ?t(J = $B4X?tL>(J( $B0z?t(J1, $B0z?t(J2,$B!D(J );
$B!Z=q<0(J2$B![(J$B!!(J $B4X?tL>(J( $B0z?t(J1, $B0z?t(J2,$B!D(J );

$BLa$jCM$,$"$k>l9g$O=q<0(J1$B!"$J$$>l9g$O=q<0(J2$B$G$9(J
$B4X?t$r8F$S$@$9$H$-$O!"
$BCm0U;v9`(J
$B!&(J$B4X?t$NDj5A!"%W%m%H%?%$%W@k8@!"8F$S$@$7$NA4$F$K$*$$$F!"(J $B0z?t$N%G!<%?7?$H$=$NJB$S=g$O!"F1$8$G$J$1$l$P$J$j$^$;$s!#(J
$B!&(J$B4X?tDj5A$K$*$1$k2>0z?t$H!"(J $B4X?t8F$S$@$7$K$*$1$kA0$O!"F1$8$G$"$kI,MW$O$"$j$^$;$s!#(J $B$`$7$m!"6hJL$9$k0UL#$GJL$NL>A0$rIU$1$k$Y$-$G$7$g$&!#(J

$BI=(J4_1 $B4X?t$N%Q%?!<%s(J
$BLa$jCM$N%G!<%?7?(J $B0z?t$N%G!<%?7?(J $B4X?t(J
int int int f( int )
float int f( float )
char int f( char )
int, float int f( int, float )
$B0z?t$J$7(J int f( void )
float int float f( int )
float float f( float )
char float f( char )
int, float float f( int, float )
$B0z?t$J$7(J float f( void )
$BLa$jCM$J$7(J int void f( int )
float void f( float )
char void f( char )
int, float void f( int, float )
$B0z?t$J$7(J void f( void )

$B4X?t$r:n$k%a%j%C%H(J
$B!|!!=hM}$NN.$l$,$D$+$_$d$9$/$J$k(J
$B$^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$r:n$k>l9g$O!"(Jmain() $B$r(J exchange() $B$K=q$-49$(!"(J $B?7$?$K(J exchange $B4X?t$r8F$S$@$9(J main $B4X?t$r5-=R$9$l$P$h$$$3$H$,J,$+$j$^$9!#(J

(IX=D(J5.1 $BBg>.Hf3S$K$h$kCM$N8r49!&$=$N#1!!(Jmain()$B4X?t$N$_(J -------------------------------------- /* * $BBg>.Hf3S$K$h$kCM$N8r49(J * main()$B4X?t$N$_(J */ #include <stdio.h> main() { $B!!!!(Jint x, y, z; /* $BJQ?t$N@k8@(J */ $B!!!!(Jprintf("please input data: x= "); /* $BCM(J x $B$NF~NO(J */ $B!!!!(Jscanf("%d", &x); $B!!!!(Jprintf("please input data: y= "); /* $BCM(J y $B$NF~NO(J */ $B!!!!(Jscanf("%d", &y); $B!!!!(Jif (x > y) { /* $BHf3S$K$h$k8r49(J */ $B!!!!!!!!(Jz = x; $B!!!!!!!!(Jx = y; $B!!!!!!!!(Jy = z; $B!!!!(J} $B!!!!(Jprintf("x=%d, y=%d\n", x, y); /* $B8r498e$N(J x, y $B$N=PNO(J */ } (IX=D(J5.2 $BBg>.Hf3S$K$h$kCM$N8r49!&$=$N#2!!(Jexchange$B4X?t$r$D$/$k(J -------------------------------- /* * $BBg>.Hf3S$K$h$kCM$N8r49(J * $BLa$jCM$d0z?t$N$J$$(J exchange $B4X?t$r$D$/$k(J */ #include <stdio.h> main() { /* $B;HMQ$9$k4X?t$N%W%m%H%?%$%W@k8@(J */ $B!!!!(Jvoid exchange( void ); /* $BLa$jCM$J$7!"0z?t$J$7$N4X?t@k8@(J */ $B!!!!(Jexchange(); /* $B4X?t$N<B9T(J */ } void exchange( void ) /* $BBg>.Hf3S$K$h$kCM$r8r49$7!"=PNO$9$k4X?t(J */ { $B!!!!(Jint x, y, z; /* $BJQ?t$N@k8@(J */ $B!!!!(Jprintf("please input data: x= "); /* $BCM(J x $B$NF~NO(J */ $B!!!!(Jscanf("%d", &x); $B!!!!(Jprintf("please input data: y= "); /* $BCM(J y $B$NF~NO(J */ $B!!!!(Jscanf("%d", &y); $B!!!!(Jif (x > y) { /* $BHf3S$K$h$k8r49(J */ $B!!!!!!!!(Jz = x; $B!!!!!!!!(Jx = y; $B!!!!!!!!(Jy = z; $B!!!!(J} $B!!!!(Jprintf("x=%d, y=%d\n", x, y); /* $B8r498e$N(J x, y $B$N=PNO(J */ }

$B!!4X?t$KCM$rEO$9(J

$B!!$3$3$G$O!"La$jCM$J$7!"0z?t$"$j$N4X?t$r:n$C$F$_$^$7$g$&!#$9$J$o$A!"4X?t$KCM$rEO$7$F$_$^$9!#(J $B$=$l$G$O!"(IX=D(J5.3$B$NMM$K%W%m%0%i%`$N0lIt$r=q$-49$($F!"J]B8!"%3%s%Q%$%k$7$F $B!!(Jmain $B4X?t$G$O(J x, y $B$NCM$rF~NO$7!"(Jexchange $B4X?t$r8F$S$@$7$F$$$^$9!#(J exchange $B4X?t$G$O!"Bg>.Hf3S$K$h$kCM$N8r49$H7k2L$N=PNO$r$7$F$$$^$9!#(J
$B!!Bg>.Hf3S$K$h$kCM$N8r49=hM}$G$O!"La$7$?$$CM$O#2$D$"$j$^$9!#(J $B$7$+$7!"La$jCM$O#1$D$K8B$i$l$k$?$a!"(Jexchange $B4X?t$NCf$G7k2L$r=PNO$7$F$$$^$9!#(J
$B!!$H$3$m$GG[Ns%G!<%?$O$I$N$h$&$KEO$;$P$h$$$G$7$g$&!#(J $B$*$^$1!!NcJ8(J1 $B$O!"J8;zG[Ns%G!<%?$N

(IX=D(J5.3 $BBg>.Hf3S$K$h$kCM$N8r49!&$=$N#3!!F~NOCM$r0z?t$H$9$k(J ---------------------------------- /* * $BBg>.Hf3S$K$h$kCM$N8r49(J * $B4X?t$K?tCM%G!<%?EO$7$9$k(J exchange $B4X?t$r$D$/$k(J */ #include <stdio.h> main() { $B!!!!(Jint x, y; /* $BJQ?t$N@k8@(J */ $B!!!!(Jvoid exchange( int, int ); /* $B;HMQ$9$k4X?t$N%W%m%H%?%$%W@k8@(J */ $B!!!!(Jprintf("please input data: x= "); /* $BCM(J x $B$NF~NO(J */ $B!!!!(Jscanf("%d", &x); $B!!!!(Jprintf("please input data: y= "); /* $BCM(J y $B$NF~NO(J */ $B!!!!(Jscanf("%d", &y); $B!!!!(Jexchange( x, y ); /* $B4X?t$N<B9T(J */ } void exchange( int x, int y ) /* $BBg>.Hf3S$K$h$kCM$r8r49$7!"=PNO$9$k4X?t(J */ { $B!!!!(Jint z; /* $BJQ?t$N@k8@(J */ $B!!!!(Jif (x > y) { /* $BHf3S$K$h$k8r49(J */ $B!!!!!!!!(Jz = x; $B!!!!!!!!(Jx = y; $B!!!!!!!!(Jy = z; $B!!!!(J} $B!!!!(Jprintf("x=%d, y=%d n", x, y); /* $B8r498e$N(J x, y $B$N=PNO(J */ } $B$*$^$1!!NcJ8(J1 $B4X?t$KJ8;z%G!<%?$rEO$9(J ----------------------------------------------------- /* * $B0';"$rJV$9%W%m%0%i%`(J * $B4X?t$KJ8;z%G!<%?$rEO$94X?t$r$D$/$k(J */ #include <stdio.h> main() { $B!!!!(Jchar name[128]; /* $BJQ?t$N@k8@(J */ $B!!!!(Jchar show_msg( char [] ); /* $B;HMQ$9$k4X?t$N%W%m%H%?%$%W@k8@(J */ $B!!!!(Jprintf("$BL>A0$O!)(J "); /* $BL>A0$NF~NO(J */ $B!!!!(Jscanf("%s", name); $B!!!!(Jshow_msg( name ); /* $B4X?t$N<B9T(J */ } void show_msg( char name[] ) /* $B0';"$rJV$94X?t(J */ { $B!!!!(Jprintf("%s$B$5$s!":#F|$O(J\n", name ); }

$B!!30ItJQ?t$rMxMQ$9$k(J

$B!!Bg>.Hf3S$K$h$kCM$N8r49=hM}$G$O!"La$7$?$$CM$O#2$D$"$j$^$9!#$7$+$7!"La$jCM$O#1$D$K8B$i$l$k$?$a!"(J $B$3$N$^$^$G$O!"(Jexchange $B4X?t$G8r49$7$?8e$N7k2L$r(J main $B4X?t$GMxMQ$9$k$3$H$,$G$-$^$;$s!#(J $B$3$NLdBj$r2r7h$9$kJ}K!$H$7$F!"(Jmain $B4X?t!"(Jexchange $B4X?t$N$I$A$i$+$i$G$bMxMQ$G$-$kMM$K!"(J $B30ItJQ?t$r@k8@$7$^$9!#(J
$B!!$=$l$G$O!"(IX=D(J5.3 $B$N%W%m%0%i%`$r!"0J2<$N(IX=D(J5.4 $B$NMM$K=q$-49$(!"J]B8!"(J $B%3%s%Q%$%k$7$F

(IX=D(J5.4 $BBg>.Hf3S$K$h$kCM$N8r49!&$=$N(J4$B!!(J $B%G!<%?$N<u$1EO$7$K30ItJQ?t$rMQ$$$k(J ------------------- /* * $BBg>.Hf3S$K$h$kCM$N8r49(J * $B30ItJQ?t$rMQ$$$?(J exchange $B4X?t$r$D$/$k(J */ #include <stdio.h> int x, y; /* x, y $B$r30ItJQ?t$H$7$F@k8@(J */ main() { $B!!!!(Jvoid exchange( void ); /* $B;HMQ$9$k4X?t$N%W%m%H%?%$%W@k8@(J */ $B!!!!(Jprintf("please input data: x= "); /* $BCM(J x $B$NF~NO(J */ $B!!!!(Jscanf("%d", &x); $B!!!!(Jprintf("please input data: y= "); /* $BCM(J y $B$NF~NO(J */ $B!!!!(Jscanf("%d", &y); $B!!!!(Jexchange( void ); /* $B4X?t$N<B9T(J */ $B!!!!(Jprintf("x=%d, y=%d n", x, y); /* $B8r498e$N(J x, y $B$N=PNO(J */ } void exchange( void ) /* $BBg>.Hf3S$K$h$kCM$r8r49$9$k4X?t(J */ { $B!!!!(Jint z; /* $BJQ?t$N@k8@(J */ $B!!!!(Jif (x > y) { /* $BHf3S$K$h$k8r49(J */ $B!!!!!!!!(Jz = x; $B!!!!!!!!(Jx = y; $B!!!!!!!!(Jy = z; $B!!!!(J} }

$B!!La$jCM$N$"$k4X?t(J

$B!!$3$3$G$O!"La$jCM$"$j!"0z?t$"$j$N4X?t$r:n$C$F$_$^$7$g$&!#(J $B$=$l$G$O!"0J2<$N(IX=D(J5.5$B$NDL$j$K%W%m%0%i%`$rF~NO!"J]B8!"%3%s%Q%$%k$7$FM5$,$"$l$PJQ?t(J a, b $B$KCM$rF~NO$9$k%W%m%0%i%`$KJQ99$7$F8+$^$7$g$&!#(J

(IX=D(J5.5 $BCM$G%G!<%?$rEO$7!"La$jCM$GJV$9(J ---------------------------------------------------- /* * $B#2$D$NCM$r2C;;$9$k(J * $B2C;;$N$?$a$N(J add $B4X?t$r$D$/$k(J */ main() { $B!!!!(Jint a = 15, b = 25; /* $BJQ?t$N@k8@$H=i4|2=(J */ $B!!!!(Jint sio1; /* $BJQ?t$N@k8@(J */ $B!!!!(Jint add( int , int ); /* $B;HMQ$9$k4X?t$N%W%m%H%?%$%W@k8@(J */ $B!!!!(Jsio1 = add(a, b); /* $B4X?t$N<B9T(J */ $B!!!!(Jprintf((IR(Jadd (%d, %d) -> %d\n(IS(J, a, b, sio1); /* $B2C;;7k2L(J $B$N=PNO(J */ } int add( int x, int y ) /* $B2C;;$9$k(J */ { $B!!!!(Jreturn (x + y); /* $B2C;;7k2L$rLa$9(J */ }

$B!!4X?t$K;2>HEO$7$9$k(J

$B!!4X?t$K%G!<%?$rEO$9J}K!$H$7$F!"CM$rEO$7$F$-$^$7$?$,!";2>HEO$7$H$$$&J}K!$b$"$j$^$9!#(J $B$=$l$G$O!"(IX=D(J5.5 $BCM$G%G!<%?$rEO$7!"La$jCM$GJV$9%W%m%0%i%`$r(IX=D(J5.6$B$NMM$K=q$-49$($F!"(J $BJ]B8!"%3%s%Q%$%k$7$F

(IX=D(J5.6 $B%]%$%s%?$r;H$C$F%G!<%?$rEO$9(J ------------------------------------------------------ /* * $B#2$D$NCM$r2C;;$9$k(J * $B;2>HEO$7$r$9$k(J add $B4X?t$r$D$/$k(J */ main() { $B!!!!(Jint a = 15, b = 25; /* $BJQ?t$N@k8@$H=i4|2=(J */ $B!!!!(Jint sio1; /* $BJQ?t$N@k8@(J */ $B!!!!(Jint add( int *, int *, int *); /* $B;HMQ$9$k4X?t$N%W%m%H%?%$%W@k8@(J */ /* $B4X?t$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$N0z?t$OL54X78(J

#include
main()
{
$B!!!!(Jint a = 100; $B!!!!!!!!!!!!(J/* $BJQ?t$N@k8@$H=i4|2=(J */
$B!!!!(Jvoid show_var( int ); $B!!!!(J/* $B%W%m%H%?%$%W@k8@(J */
$B!!!!(Jprintf("a = %d\n", a); $B!!(J/* $BJQ?t(J a $B$r=PNO(J */
$B!!!!(Jshow_var( a );$B!!!!!!!!!!(J/* show_var $B4X?t$r $B!!!!(Jprintf("a = %d\n", a); $B!!(J/* $BJQ?t(J a $B$r=PNO(J */
}

void show_var( int x )
{
$B!!!!(Jprintf("x = %d\n", x);$B!!(J/* $BJQ?t(J x $B$r=PNO(J */
$B!!!!(Jx = 500;$B!!!!!!!!!!!!!!!!(J/* $BJQ?t(J x $B$K(J 500 $B$rBeF~(J */
$B!!!!(Jprintf("x = %d\n", x); $B!!(J/* $BJQ?t(J x $B$r=PNO(J */
}
$B!|!!8F$S$@$7B&$NJQ?t$H!"8F$P$l$kB&$N0z?t$OF1$8HVCO$NJQ?t(J
#include
main()
{
$B!!!!(Jint a = 100; $B!!!!!!!!!!!!!!(J/* $BJQ?t$N@k8@$H=i4|2=(J */
$B!!!!(Jvoid show_var( int * ); $B!!!!(J/* $B%W%m%H%?%$%W@k8@(J */
$B!!!!(Jprintf("a = %d\n", a); $B!!!!(J/* $BJQ?t(J a $B$r=PNO(J */
$B!!!!(Jshow_var( &a );$B!!!!!!!!!!(J/* show_var $B4X?t$r $B!!!!(Jprintf("a = %d\n", a); $B!!!!(J/* $BJQ?t(J a $B$r=PNO(J */
}

void show_var( int *x )
{
$B!!!!(Jprintf("x = %d\n", *x);$B!!(J/* $BJQ?t(J x $B$r=PNO(J */
$B!!!!(J*x = 500;$B!!!!!!!!!!!!!!!!(J/* $BJQ?t(J x $B$K(J 500 $B$rBeF~(J */
$B!!!!(Jprintf("x = %d\n", *x); $B!!(J/* $BJQ?t(J x $B$r=PNO(J */
}

$B!!:F5"8F$S=P$7$9$k(J

$B!!4X?t$O!"<+J,<+?H$r8F$S$@$9$3$H$,$G$-$^$9!#(J $B$=$NNc$H$7$F$h$/=P$F$/$k$N$,3,>h$N7W;;$r$9$k%W%m%0%i%`$,$"$j$^$9!#(J
$B!!!!@0?t(J n $B$N3,>h!!(Jn! = n $B!_(J (n-1) $B!_(J (n-2) $B!_!D(J $B!_(J 2 $B!_(J 1
$B!!$=$l$G$O!"(IX=D(J5.7$B$NDL$j$K%W%m%0%i%`$rF~NO!"J]B8!"(J $B%3%s%Q%$%k$7$Fh$NCM$r!"%+%s%^Ey$G6h@Z$C$FF~NO$9$k$H!"7W;;7k2L$rI=<($7$^$9!#(J $B$?$@$7!"%*!<%P!<%U%m!<%(%i!e$NCM$,F~NO$5$l$k$H(J -1 $B$,I=<($5$l$^$9!#(J

(IX=D(J5.7 $B:F5/=hM}(J $B3,>h$N7W;;(J --------------------------------------------------------------- #include <stdio.h> main() { $B!!!!(Jint InputNo; $B!!!!!!!!!!!!!!!!(J $B!!(J/* $BJQ?t$N@k8@(J */ $B!!!!(Jint Factorial( int ); $B!!!!(J /* $B%W%m%H%?%$%W@k8@(J */ $B!!!!(Jwhile (scanf((IR(J%d(IS(J, &InputNo) != EOF) /* $B3,>h7W;;$9$kCM$rA4$FFI$_9~$`(J */ $B!!!!!!!!(Jprintf((IR(J%d\n(IS(J, Factorial( InputNo ));$B!!(J /* Factorial $B4X?t$N<B9T$H!"7k2L$N=PNO(J */ } int Factotial( int n ) /* $B3,>h7W;;$9$k4X?t(J */ { $B!!!!(Jif ((n < 0) || (n >= 10)) /* $B%(%i!<2r=|$N$?$a$NGS=|>r7o(J */ $B!!!!!!!!(Jreturn (IP(J1; $B!!!!(Jelse if (n <= 1) /* $B:F5"8F$S=P$7=*N;>r7o(J */ $B!!!!!!!!(Jreturn 1; $B!!!!(Jelse $B!!!!!!!!(Jreturn n * Factorial(n (IP(J 1); /* $B:F5"8F$S=P$7(J */ }

$B!!:F5"8F$S=P$7$NMxE@$O!"J#;($J=hM}$r%9%^!<%H$K5-=R$G$-$k$3$H$G$9!#(J $B$7$+$7!":F5"8F$S=P$74X?t$r:n$k$K$"$?$j!"=EMW$JCm0U;v9`$,$"$j$^$9!#(J $B$=$l$O!":F5"8F$S=P$7$G$OI,$:=*N;>r7o$r;XDj$9$k$3$H$G!"$b$7!"$3$l$,$J$$$H!"(J $B:F5"8F$S=P$7$rL58B$K7+$jJV$9$3$H$K$J$j$^$9!#(J

$B!!%i%$%V%i%j4X?t$r;H$&(J

$B!!#C8@8l$G$O!"(Jif$B!"(Jfor$B!"(Jwhile $B$J$I$N@)8fJ8$K$h$k=hM}$NN.$l$rJQ$($kJ80J30$O!"(J $BFCDj$N=hM}$r9T$&$?$a$N$b$N$O!"I8=`4X?t$H$7$FMQ0U$5$l$F$$$^$9!#(J $B$9$G$K!":#$^$G;H$C$F$-$?(J printf$B!"(Jscanf $B0J30$K$bB?$/$N4X?t$,$"$k$N$G!"(J $B$3$3$G;H$C$F$_$^$9!#$J$*!"0lIt$NI8=`4X?t$rI=(J5_1$B$K$^$H$a$^$7$?!#(J
$B!!$=$l$G$O!"(IX=D(J5.8$B$NDL$j$K%W%m%0%i%`$rF~NO!"J]B8!"(J $B%3%s%Q%$%k$7$F

(IX=D(J5.8 $B?t3X4X?t$r;H$&(J -------------------------------------------------------------- /* * 10 $BEY$+$i(J 80 $BEY$^$G$N%5%$%sCM0lMwI=$r=PNO$9$k(J */ #include <stdio.h> #include <math.h> /* $B%5%$%s4X?tMQ$N%W%m%H%?%$%W$,5-=R$5$l$F$$$k%X%C%@%U%!%$%k(J */ #define PAI 3.14149 main() { $B!!!!(Jint i;$B!!!!!!!!!!!!!!!!(J / * $BJQ?t$N@k8@(J */ $B!!!!(Jfloat d; $B!!!!(Jfor ( i = 10; i <= 80; i += 10 ) { $B!!!!!!!!(Jd = sin( i * PAI / 180.0 );$B!!!!!!(J /* $B3QEY$r%i%8%"%s$KJQ49$7$F!"%5%$%sCM$r7W;;(J */ $B!!!!!!!!(Jprintf("%d %f\n", i, d ); /* $B%5%$%sCM$N=PNO(J */ $B!!!!(J} }

$BI=(J5_1 $BI8=`4X?t$N0lMw(J
$BF~=PNO4X?t!J%X%C%@!'(Jstdio.h $B!K(J
$B4X?t$N5!G=(J $B4X?t$N7A<0(J $B@bL@(J
$B=q<0IU$-=PNO(J printf($B@)8fJ8;zNs(J, $B0z?t(J); $B2hLL$J$I$KI=<((J
$B!JNc!K(J$B!!(Jprintf("%d\n", 10);
$B=q<0IU$-F~NO(J scanf($B@)8fJ8;zNs(J, $B0z?t(J); $B%-!<%\!<%I$J$I$+$iF~NO(J
$B!JNc!K(J$B!!(Jint n;
$B!!!!!!!!(J scanf("%d", &n);
$B#1J8;z=PNO(J putchar($BJ8;z(J); $B2hLL$J$I$K#1J8;z=PNO(J $B!JNc!K(J$B!!(Jint c;
$B!!!!!!!!(J putchar(c);
$B#1J8;zF~NO(J getchar(); $B%-!<%\!<%I$J$I$+$i#1J8;zF~NO(J
$B!JNc!K(J$B!!(Jint c;
$B!!!!!!!!(J c = getchar();
$B#19T=PNO(J puts($BJ8;zNs(J); $B2hLL$J$I$KJ8;zNs$r=PNO(J
$B!JNc!K(J$B!!(Jchar a[80];
$B!!!!!!!!(J puts(a);
$B#19TF~NO(J gets($BJ8;zNs(J); $B%-!<%\!<%I$J$I$+$iJ8;zNs$rF~NO(J
$B!JNc!K(J$B!!(Jchar a[80];
$B!!!!!!!!(J gets(a);
$BJ8;zNsA`:n!J%X%C%@!'(Jstring.h $B!K(J
$B4X?t$N5!G=(J $B4X?t$N7A<0(J $B@bL@(J
$BJ8;zNs$NJ# strcpy($BJ8;zNs(J1, $BJ8;zNs(J2); $BJ8;zNs(J2 $B$rJ8;zNs(J1 $B$KJ#
$B!JNc!K(J$B!!(Jchar a[20], b[20];
$B!!!!!!!!(J strcpy(a, b);
$BJ8;zNs$NO"7k(J strcat($BJ8;zNs(J1, $BJ8;zNs(J2); $BJ8;zNs(J2 $B$rJ8;zNs(J1 $B$N8e$m$KO"7k(J
$B!JNc!K(J$B!!(Jchar a[40], b[20];
$B!!!!!!!!(J strcat(a, b);
$BJ8;zNs$NHf3S(J strcmp($BJ8;zNs(J1, $BJ8;zNs(J2); $BJ8;zNs$rHf3S(J
$B!JNc!K(J$B!!(Jchar a[20], b[20];
$B!!!!!!!!(J int n;
$B!!!!!!!!(J n = strcmp(a, b);
$BJ8;zNs(J1>$BJ8;zNs(J2$B$N$H$-$O@5$NCM$rJV$9(J
$BJ8;zNs(J1=$BJ8;zNs(J2$B$N$H$-$O(J 0 $B$NCM$rJV$9(J
$BJ8;zNs(J1<$BJ8;zNs(J2$B$N$H$-$OIi$NCM$rJV$9(J
$BJ8;zNs$ND9$5$r5a$a$k(J strlen($BJ8;zNs(J); $BJ8;zNs$ND9$5$r5a$a$k(J
$B!JNc!K(J$B!!(Jchar a[20];
$B!!!!!!!!(J int n;
$B!!!!!!!!(J n = strlen(a);
$BJ8;zA`:n!J%X%C%@!'(Jctype.h$B!K(J
$B4X?t$N5!G=(J $B4X?t$N7A<0(J $B@bL@(J
$B1QJ8;z8!::(J isalpha($BJ8;z(J); $BJ8;z$,1QJ8;z$G$"$k$+8!::(J
$B!JNc!K(J$B!!(Jint a, n;
$B!!!!!!!!(J n = isalpha(a);
$BJ8;z$,1QJ8;z$N$H$-$O(J 0 $B0J30$NCM$rJV$9(J
$BJ8;z$,1QJ8;z0J30$N$H$-$O(J 0 $B$NCM$rJV$9(J
$B4XO"4X?t$H$7$F(J isupper, islower, isdigit $B$J$I$,$"$k(J
$B1QBgJ8;zJQ49(J isalpha($BJ8;z(J); $B1Q>.J8;z$r1QBgJ8;z$KJQ49$9$k(J
$B!JNc!K(J$B!!(Jint a, b;
$B!!!!!!!!(J b = toupper(a);
$B4XO"4X?t$H$7$F(J tolower $B$,$"$k(J
$B?t3X4X?t!J%X%C%@!'(Jmath.h$B!K(J
$B4X?t$N5!G=(J $B4X?t$N7A<0(J $B@bL@(J
$B@dBPCM$r5a$a$k(J abs($B?tCM(J); $B?tCM$N@dBPCM$r5a$a$k(J
$B!JNc!K(J$B!!(Jint a, n;
$B!!!!!!!!(J n = abs(a);
$B%5%$%sCM$r5a$a$k(J sin($B?tCM(J); $B?tCM!J%i%8%"%s!K$N%5%$%sCM$r5a$a$k(J
$B!JNc!K(J$B!!(Jdouble a, n;
$B!!!!!!!!(J n = sin(a);
$B4XO"4X?t$H$7$F(J cos, tan $B$=$NB>;03Q4X?t$,$"$k(J
$B;X?t4X?tCM$r5a$a$k(J exp($B?tCM(J); $B?tCM$N(J e $B$KBP$9$k;X?t4X?tCM$r5a$a$k(J
$B!JNc!K(J$B!!(Jdouble a, n;
$B!!!!!!!!(J n = exp(a);
$B4XO"4X?t$H$7$F(J log $B$,$"$k(J
$BJ?J}:,$r5a$a$k(J sqrt($B?tCM(J); $B?tCM$N(J $BJ?J}:,$r5a$a$k(J
$B!JNc!K(J$B!!(Jdouble a, n;
$B!!!!!!!!(J n = sqrt(a);
$B4XO"4X?t$H$7$F(J sqr$B!J?tCM$NJ?J}$r5a$a$k!K(J $B$,$"$k(J
$B>h$8$?CM$r5a$a$k(J power($B?tCM(J1, $B?tCM(J2); $B?tCM(J1 $B$r!J?tCM(J2 $B!K>h$7$?CM$r5a$a$k(J
$B!JNc!K(J$B!!(Jdouble a, b, n;
$B!!!!!!!!(J n = power(a, b);
$B$^$?$O!!(J n = pow(a, b);<
$B$=$NB>$N4X?t!J%X%C%@!'(Jstdlib.h$B!K(J
$B4X?t$N5!G=(J $B4X?t$N7A<0(J $B@bL@(J
$BJ8;zNs$r(J int $B7?@0?t$KJQ49(J atoi($BJ8;zNs(J); $B?tCMJ8;zNs$r(J int $B7?@0?t$KJQ49(J
$B!JNc!K(J$B!!(Jint n;
$B!!!!!!!!(J n = atoi("12345");
$BMp?t$rH/@8$5$;$k(J rand(); $BMp?t$rH/@8$5$;$k(J
$B!JNc!K(J$B!!(Jint n;
$B!!!!!!!!(J n = rand();
$BMp?t$rH/@8$5$;$k(J rand($B?tCM(J); $B
$B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while ( $BJ8;z(J != EOF )
$B$r;H$$$^$9!#(J

$BF~NO2hLL$NNc(J
$B>.J8;z$rBgJ8;z$KJQ49$9$k%W%m%0%i%`(J
$BJQ49$7$?$$J8;zNs$O!'(Jabcdefg
$BJQ498e$NJ8;zNs$O!'(JABCDEFG
$BCm!K(J$B@D?'ItJ,(J$B$,F~NO$7$?CM$G$9!#(J

$B2]Bj#4(J $B!!%7%9%F%`4X?t$r;H$C$F(JMS-DOS$B%3%^%s%I$r

$BF~NO2hLL$NNc(J
%copy filename1 filename2
$BCm!K(J$B@D?'ItJ,(J$B$,F~NO$7$?%3%^%s%I$G$9!#(J


$B!!$*$^$1!!%2!<%`!V#3L\$J$i$Y!W$G$"$=$V(J

$B#3L\$J$i$Y(J $B!!#2?MBP@o7?$N#3L\$J$i$Y$N%2!<%`$G$9!#%3%s%Q%$%k$7$FM7$s$G$_$F$/$@$5$$!#(J
$B@h

/********************************** * $B#3L\JB$Y!!#2?MBP@o%W%m%0%i%`(J * **********************************/ #include <stdio.h> #include <stdlib.h> int ban[3][3] = { { 0, 0, 0 }, { 0, 1, 0 }, { 0, 0, 0 } }; main() { int junban = 1, nokori = 0, tekazu = 1; int ban_hyouji( int ); int te( int ); int saigo( int ); printf("***** $B#3L\JB$Y$r;O$a$^$9!#(J *****\n"); printf("***** $BCfCG$9$k>l9g$O#0$rF~NO$7$F$/$@$5$$(J *****\n"); while ( 1 ) { nokori = ban_hyouji( junban ); if (nokori == -1) { if (junban == 1) { printf("$B@h<j$N>!$A(J\n"); break; } else { printf("$B8e<j$N>!$A(J\n"); break; } } if (nokori == -2) { printf("$B>!Ii0z$-J,$1(J\n"); break; } if (tekazu == 9) { printf("$B>!Ii0z$-J,$1(J\n"); break; } junban *= -1; if (tekazu == 8) { nokori = saigo( nokori ); tekazu++; continue; } tekazu++; nokori = te( junban ); if (nokori == -2) { printf("$B>!IiCf;_(J\n"); break; } } } int ban_hyouji( int junban ) { int j, nokori = 0; int i0, i1, i2, j0, j1, j2, ij, ji; int x0, x1, x2, y0, y1, y2, xy, yx; int gyo( int ); printf("+--+--+--+\n"); j = 0; nokori += gyo( j ); printf("+--+--+--+\n"); j = 1; nokori += gyo( j ); printf("+--+--+--+\n"); j = 2; nokori += gyo( j ); printf("+--+--+--+\n"); i0 = ban[ 0 ][ 0 ] + ban[ 1 ][ 0 ] + ban[ 2 ][ 0 ]; i1 = ban[ 0 ][ 1 ] + ban[ 1 ][ 1 ] + ban[ 2 ][ 1 ]; i2 = ban[ 0 ][ 2 ] + ban[ 1 ][ 2 ] + ban[ 2 ][ 2 ]; j0 = ban[ 0 ][ 0 ] + ban[ 0 ][ 1 ] + ban[ 0 ][ 2 ]; j1 = ban[ 1 ][ 0 ] + ban[ 1 ][ 1 ] + ban[ 1 ][ 2 ]; j2 = ban[ 2 ][ 0 ] + ban[ 2 ][ 1 ] + ban[ 2 ][ 2 ]; ij = ban[ 0 ][ 0 ] + ban[ 1 ][ 1 ] + ban[ 2 ][ 2 ]; ji = ban[ 0 ][ 2 ] + ban[ 1 ][ 1 ] + ban[ 2 ][ 0 ]; x0 = abs(ban[ 0 ][ 0 ]) + abs(ban[ 1 ][ 0 ]) + abs(ban[ 2 ][ 0 ]); x1 = abs(ban[ 0 ][ 1 ]) + abs(ban[ 1 ][ 1 ]) + abs(ban[ 2 ][ 1 ]); x2 = abs(ban[ 0 ][ 2 ]) + abs(ban[ 1 ][ 2 ]) + abs(ban[ 2 ][ 2 ]); y0 = abs(ban[ 0 ][ 0 ]) + abs(ban[ 0 ][ 1 ]) + abs(ban[ 0 ][ 2 ]); y1 = abs(ban[ 1 ][ 0 ]) + abs(ban[ 1 ][ 1 ]) + abs(ban[ 1 ][ 2 ]); y2 = abs(ban[ 2 ][ 0 ]) + abs(ban[ 2 ][ 1 ]) + abs(ban[ 2 ][ 2 ]); xy = abs(ban[ 0 ][ 0 ]) + abs(ban[ 1 ][ 1 ]) + abs(ban[ 2 ][ 2 ]); yx = abs(ban[ 0 ][ 2 ]) + abs(ban[ 1 ][ 1 ]) + abs(ban[ 2 ][ 0 ]); if ( i0 == 3 * junban || i1 == 3 * junban || i2 == 3 * junban || j0 == 3 * junban || j1 == 3 * junban || j2 == 3 * junban || ij == 3 * junban || ji == 3 * junban) return ( -1 ); else if (((x0 == 2 && i0 == 0) || x0 == 3) && ((x1 == 2 && i1 == 0) || x1 == 3) && ((x2 == 2 && i2 == 0) || x2 == 3) && ((y0 == 2 && j0 == 0) || y0 == 3) && ((y1 == 2 && j1 == 0) || y1 == 3) && ((y2 == 2 && j2 == 0) || y2 == 3) && ((xy == 2 && ij == 0) || xy == 3) && ((yx == 2 && ji == 0) || yx == 3)) return ( -2 ); else return ( nokori ); } int gyo( int j ) { int i, me, nokori = 0; for (i = 0; i < 3; i++) { me = 3 * j + (i + 1); printf("|"); if (ban[ j ][ i ] == 0) { nokori += me; if ( me == 1 ) printf("$B#1(J"); else if ( me == 2 ) printf("$B#2(J"); else if ( me == 3 ) printf("$B#3(J"); else if ( me == 4 ) printf("$B#4(J"); else if ( me == 6 ) printf("$B#6(J"); else if ( me == 7 ) printf("$B#7(J"); else if ( me == 8 ) printf("$B#8(J"); else printf("$B#9(J"); } else { if (ban[ j ][ i ] > 0) printf("$B!{(J"); else printf("$B!_(J"); } } printf("|\n"); return ( nokori ); } int te( int junban ) { int i, j, ichi = 10; while (ichi < 0 || ichi > 9) { if (junban == 1) printf("$B@h<jF~NO!'(J"); else printf("$B8e<jF~NO!'(J"); scanf("%d", &ichi); } if (ichi == 0) return ( -2 ); ichi--; i = ichi % 3; j = ichi / 3; ban[ j ][ i ] = junban; return ( 0 ); } int saigo( int ichi ) { int i, j; printf("$B@h<jF~NO!'(J%d\n", ichi); ichi--; i = ichi % 3; j = ichi / 3; ban[ j ][ i ] = 1; return ( 0 ); }

$B!!$*$^$1!!%j%@%$%l%/%H$r;H$&!V%=!<%H!W%W%m%0%i%`(J

$B%=!<%H(J $B!!%-!<%\!<%IF~NO$7$??tCM%G!<%?$r%=!<%H$9$k%W%m%0%i%`$G$9$,!"(J $BA0$b$C$F:n@.$7$??tCM%G!<%?%U%!%$%k$r%j%@%$%l%/%H$5$;$k$3$H$G%=!<%H$5$;$k$3$H$,=PMh$^$9!#(J $BF1MM$K$7$F!"7k2L$r%U%!%$%k$K=PNO$9$k$3$H$b2DG=$G!";HMQK!$O!"0J2<$NMM$K$7$^$9!#(J

$BF~NO2hLL$NNc(J
%sort
14 42 85 26 35 12 95 (I%%%%%%%%(J 65 57
%sort < data
%sort < data > sort_data
$BCm!K(Jsort$B!!!!!!!!!!!!!!!!!!!!!!(J $B%=!<%H$N$B?tCM%G!<%?(J
$B$r%-!<%\!<%IF~NO!"!V(J$B%3%s%H%m!<%k(J$B!W(J+ $B!V(Jd$B!W$K$F=*N;!#(J
$B!!!!(Jsort < data$B!!!!!!!!!!!!!!(Jdata$B$,%=!<%H$7$?$$%G!<%?$,F~$C$F$$$k%U%!%$%k$G$9!#(J
$B!!!!(Jsort < data > sort_data$B!!(Jsort_data$B$,%=!<%H$r9T$C$?8e$N%G!<%?$,F~$k%U%!%$%k$G$9!#(J

/* $B%=!<%H%W%m%0%i%`(J */ /* $B@0?t(J100$B%G!<%?$^$G(J */ #include <stdio.h> #define MAX 100 main() { int i = 0, j, data_end, ex_data, data[100]; while (scanf("%d", &ex_data) != EOF) { if (i < MAX) { data[ i ] = ex_data; } i++; } if (i >= MAX) { printf("data overflow!\n"); i = MAX; } data_end = i - 1; for (i = 0; i < data_end - 1; i++) { for (j = i + 1; j < data_end ; j++) { if (data[ i ] > data[ j ]) { ex_data = data[ i ]; data[ i ] = data[ j ]; data[ j ] = ex_data; } } } for (i = 0; i < data_end; i++) { printf("%d\t", data[ i ]); } printf("\n"); }

$B!!$*$^$1!!0z?t$rEO$7$F!V%F%-%9%H$r=PNO!W$9$k%W%m%0%i%`(J

$B%X%C%I=PNO(J $B!!%F%-%9%H%U%!%$%k$N;O$a$N?t9T$r=PNO$9$k%W%m%0%i%`!#(J
$B=PNO9T?t$O!V(J-$B!W$rIU$1$F%*%W%7%g%s;XDj$7$^$9!#(J $B$3$l$rH/E8$5$;$F!":G8e$N?t9T$r=PNO$9$k%W%m%0%i%`!V(Jtail$B!W$r:n@.$7$F$_$^$;$s$+!#(J

$BF~NO2hLL$NNc(J
%head -15 head.c
$BCm!K(Jhead$B$,-15
$B$,=PNO9T?t!"(J head.c$B$,=PNO$5$;$?$$%U%!%$%k$G$9!#(J

$B0z?t$N$"$k(J main$B4X?t(J $B$NNc(J
$B!|!!0z?t$rI=<($9$k%W%m%0%i%`(J
/* CMD Int */
#include

main(int argc, char *argv[])
{
$B!!(Jint i = 1;

/* $B%]%$%s%?$r;H$o$:$KI=<($9$k(J */
$B!!(Jwhile (i <= argc) {
$B!!!!(Jprintf("%2d:%s\n", i, argv[i - 1]);
$B!!!!(Ji++;
$B!!(J }

/* $B%]%$%s%?$r;H$C$FI=<($9$k(J */
$B!!(Ji = 1;
$B!!(Jwhile (i <= argc) {
$B!!!!(J printf("2d:%s\n", i, *argv);
$B!!!!(J*argv++;
$B!!!!(J i++;
$B!!(J }
}

$B!|!!%W%m%0%i%`$N;H$$J}(J
%cmd opt1 opt2 (I%%%(J
$BCm!K(Jcmd$B$,cmd
$B!"(J opt1$B!"(J opt2 (I%%%(J$B$,0z?t$H$7$F(J main$B4X?t(J $B$KEO$5$l!"(J
$B#22s!"(Jopt1$B!"(Jopt2$B!&!&!&$,=PNO$5$l$^$9!#(J

/* head$B%W%m%0%i%`(J */ #include <stdio.h> #include <stdlib.h> #include <string.h> main( int argc, char *argv[] ) { FILE *fin; /* $B%U%!%$%k%]%$%s%?$N@k8@(J */ char buf[256]; char filename[20]; int i, lines; if (argc != 3) { printf("usage: <opt> {filename}\n"); exit(-1); } if (*argv[1] == '-') { lines = atof(argv[1]) * (-1); } else { printf("option error !\n"); exit(-1); } strcpy(filename, argv[2] ); fin = fopen(filename, "r"); /* $BF~NOMQ%U%!%$%k$r%*!<%W%s(J */ if (fin == NULL) { printf("%s not open !\n", filename); exit(-1); } i = 1; while ( fgets(buf, 256, fin) != NULL ) { /* $B%U%!%$%k$+$iFI$_9~$_(J */ printf("%s", buf ); /* $B$=$l$rI=<($9$k(J */ i++; if (i > lines) { break; } } fclose(fin); }

$B!!$*$^$1!!%7%9%F%`4X?t$r;H$C$F(J MS-DOS $B$r%(%_%e%l!<%H$9$k!#(J

MS-DOS$B%(%_%e%l!<%?(J $B!!(JUNIX$B>e$G(JMS-DOS$B$r5?;wE*$K9T$&%W%m%0%i%`$G$9!#(J
MS-DOS$B%3%^%s%I$N(J DEL(rm), DIR(ls), REN(mv), TYPE(cat), COPY(cp), DATE(date)$B$,;H$($^$9!#(J

$B%W%m%0%i%`$,9T$&FbMF$H!"(JMS-DOS$B$H(JUNIX$B$N%3%^%s%I$N0c$$(J
$B!|!!(JMS-DOS $B%3%^%s%IF~NO$+$i!"%3%^%s%I$H$=$N%*%W%7%g%s$rJ,N%$7!"(J ap[0]$B!"(Jap[1]$B!"(Jap[2] $B$K3JG<$9$k!#(J
printf(">");
gets( lp );
sscanf(lp, "%s %s %s", ap[0], ap[1], ap[2]);

$B!|!!(JMS-DOS $B%3%^%s%I$r!"(JUNIX $B%3%^%s%I$KJQ99$7!"(Jap[0] $B$K3JG<$9$k!#(J
if ( strcmp(ap[0], "type") == 0 || strcmp(ap[0], "TYPE") == 0 )
$B!!(Jstrcpy(ap[0], "cat");

$B!|!!(JUNIX $B%3%^%s%I$r(J System $B4X?t$r;H$C$F
sprintf( sp, "%s %s %s", ap[0], ap[1], ap[2] );
system( sp );
MS-DOS UNIX
$B!|!!%U%!%$%k$NFbMF$r=PNO$9$k(J
TYPE filename cat filename
$B!|!!%U%!%$%k$r%3%T!<$9$k(J
COPY filename1 filename2 cp filename1 filename2
$B!|!!%U%)%k%@$^$?$O%G%#%l%/%H%j$NFbMF$rI=<($9$k(J
DIR ls
$B!|!!%U%!%$%kL>$rJQ99$9$k(J
REN filename1 filename2 mv filename1 filename2
$B!|!!%U%!%$%k$r>C5n$9$k(J
DEL filename rm filename
$B!|!!F|IU$rI=<($9$k(J
DATE date
$B!|!!(JDOS $B$r=*N;$9$k(J
Q

/* mini D0S (3)*/ #include <stdio.h> #include <stdlib.h> #include <string.h> main() { static char cmdlin[150], syslin[150]; static char arg[4][50]; int prm_err; void cmd_in( char [], char [][50] ); int cmd_search( char [], char [][50] ); printf("Well Come to mini MS-DOS World !\n"); cmd_in( cmdlin, arg ); while ( strcmp(arg[0], "q") != 0 ) { prm_err = cmd_search( syslin, arg ); if (prm_err == 0) { system( syslin ); } else { printf("\nCommand not found !\n"); } cmd_in( cmdlin, arg ); } printf("\nmini MS-DOS Exit !\n"); } void cmd_in( char lp[], char ap[][50] ) { int i; memset(lp, '\0', 150); for (i = 0; i < 3; memset(ap[i++], '\0', 50) ); printf(">"); gets( lp ); sscanf(lp, "%s %s %s", ap[0], ap[1], ap[2]); } int cmd_search( char sp[], char ap[][50] ) { int err = 0; if ( strcmp(ap[0], "type") == 0 || strcmp(ap[0], "TYPE") == 0 ) strcpy(ap[0], "cat"); else if ( strcmp(ap[0], "copy") == 0 || strcmp(ap[0], "COPY") == 0 ) strcpy(ap[0], "cp"); else if ( strcmp(ap[0], "dir") == 0 || strcmp(ap[0], "DIR") == 0 ) strcpy(ap[0], "ls"); else if ( strcmp(ap[0], "ren") == 0 || strcmp(ap[0], "REN") == 0 ) strcpy(ap[0], "mv"); else if ( strcmp(ap[0], "del") == 0 || strcmp(ap[0], "DEL") == 0 ) strcpy(ap[0], "rm"); else if ( strcmp(ap[0], "date") == 0 || strcmp(ap[0], "DATE") == 0 ) strcpy(ap[0], "date"); else { err = -1; return( -1 ); } if (err == 0) sprintf( sp, "%s %s %s", ap[0], ap[1], ap[2] ); return( err ); }

$B"%#C8@8lL\


Copyrights(c) 2000 $B%6%6Cn(J. All rights reserved.