prog-text.dvi

Size: px
Start display at page:

Download "prog-text.dvi"

Transcription

1 (C ) E mail : sakkun@yokohama-cu.ac.jp

2

3 3 I OS C Windows sample1.c C C sample1.c sample2.c

4 sample2.c C sample2.c if sample3.c sample3.c Windows sample4.c sample5.c

5 6.1.3 do while() while() for() hanpuku.c hanpuku.c sample6.c sample7.c sample7.c sample8.c sample9.c C ftest1.c ftest1.c ftest2.c ftest3.c

6 II sample1.c sample2.c sample3.c sample4.c sample5.c sample6.c sample7.c sample8.c sample9.c test.txt ftest1.c ftest2.c ftest3.c (1) (2) III C

7 printf scanf ( 2) goto do while while for break switch case stdio.h string.h ctype.h math.h FILE fopen fclose

8 8 A 113 B 115

9 ENIAC if do while while for() switch case

10

11 C C stdio.h string.h ctype.h math.h fopen

12

13 I

14

15 15 C

16

17 OS OS 2 1 ENIAC Operating System

18 : OS OS ROM 3 OS IPL 4 3 Read Only Memory RAM Random Access Memory 4 Initial Program Loader

19 : ENIAC BIOS Basic Input Output System

20 : BASIC Beginner s All-purpose Symbolic Instruction Code Fortran FORmular TRANslator COBOL COmmon Business Oriented Language C next B C++ increased C C ++ C Pascal PL/I Programming Language One LISP LISt Processor Prolog PROgramming in LOGic Perl Java Tcl Ruby 6 AND OR NOT 7 mnemonic 8 bug= debug

21 : BMD, S, SPSS, SAS DYNAMO, GPSS TEX, PostScript HTML C C TEX 10 C C

22 OS Windows GUI Microsoft (IDE 12 ) Visual Studio.NET Sun Micro System Java (SDK 13 ) Eclipse 11 Graphical User Interface 12 Integrated Development Environment 13 Software Development Kit

23 Windows Ctrl+Alt+Del 1 Ctrl Alt Delete * OK Windows Internet Explorer 1 Windows

24 Enter C z: OK 7. z: samples kinshu1.c ftest1.c ftest3.c sample1.c sample9.c 8. Internet Explorer 9. z:

25 2.3. sample1.c sample1.c 2 sample1 II sample1.c OK Page Up Page Down sample1.c This is a sample program. Press any key to continue Ctrl C 2.3 sample1.c 2

26 C 34 printf 3 " \n n C III 2.4 sample1.c Insert Visual C++ 3

27 2.4. sample1.c 27 Back Space Delete ON/OFF / Page Up Page Down sample1.c sample1.c 1. sample1.c sample1a.c 2. 3.

28

29 sample2.c sample1.c sample1.c sample2.c sample2.c sample2 3.2 sample2.c 3.2.1

30 30 3 6m 4m D H S S = 1 2 DH S D H x +3=0 x x = III

31 C D teihen H takasa S menseki int float ( ) (float) float teihen, takasa, menseki ; float teihen, takasa, menseki ; menseki = teihen * takasa / 2 ; printf printf("menseki = %g\n", menseki) ; 2 III

32 32 3 float teihen, takasa, menseki ; menseki = teihen * takasa / 2 ; printf("menseki = %g\n", menseki) ; #include <stdio.h> int main() { float teihen, takasa, menseki ; teihen = 6 ; takasa = 4 ; menseki = teihen * takasa / 2 ; printf("menseki = %g\n", menseki) ; return 0 ; } sample2.c 3.3 sample2.c sample2.c sample1.c sample2.c 3.3.1

33 sample2.c 6 4 C scanf teihen = 6 ; scanf("%g", &teihen) ; takasa = 4 ; scanf("%g", &takasa) ; scanf float %g 1 & 6 Enter scanf 1 int %d

34 34 4 teihen 6 4 Enter takasa if if sample2.c 4.1 a, b, c a, b, c A c b C B a 4.1:

35 4.3. sample3.c C a b a c C a == b && a == c b == c if if( a == b && a == c ) printf(" \n") ; printf 4.3 sample3.c 4.4 sample3.c if C if sample3.c 4.3

36 : :

37 Yes No 2 Yes No 4.3: C a*a+b*b == c*c a*a+c*c == b*b b*b+c*c == a*a

38 Windows Windows Windows

39 c.h.cc.cpp.c++.obj.exe.com ( ) ( ) CPU.h.lib.dll CPU 5.1: Visual Studio.NET 2003

40 sample4.c , 1, 2 1 srand rand 2 time 5.3 sample5.c

41 5.3. sample5.c if BMI 3 BMI (kg) (m) 2 BMI BMI BMI 22 % %% 3 Body Mass Index

42

43 float hankei, menseki ; printf("hankei?") ; scanf("%g",&hankei) ; menseki = hankei*hankei*3.14 ; printf("menseki = %g\n",menseki) ; printf("hankei?") ; scanf("%g",&hankei) ; menseki = hankei*hankei*3.14 ; printf("menseki = %g\n",menseki) ; goto float hankei, menseki ; hajime : hajime printf("hankei?") ; scanf("%g",&hankei) ; menseki = hankei*hankei*3.14 ; printf("menseki = %g\n",menseki) ; goto hajime ; hajime

44 44 6 goto if goto 5 if c float hankei, menseki ; int c ; c = 0 ; hajime : hajime printf("hankei?") ; scanf("%g",&hankei) ; menseki = hankei*hankei*3.14 ; printf("menseki = %g\n",menseki) ; c = c+1 ; 1 if( c<5 ) goto hajime ; hajime do while() if goto C do while float hankei, menseki ; int c ; c = 0 ; do { printf("hankei?") ; scanf("%g",&hankei) ; menseki = hankei*hankei*3.14 ; printf("menseki = %g\n",menseki) ; c = c+1 ; 1 } while( c<5 ) ; REPEAT UNTIL

45 while() for() if float hankei, menseki ; int c ; c = 0 ; hajime: if( c>=5 ) goto owari ; printf("hankei?") ; scanf("%g",&hankei) ; menseki = hankei*hankei*3.14 ; printf("menseki = %g\n",menseki) ; c = c+1 ; goto hajime ; owari: if goto while float hankei, menseki ; int c ; c = 0 ; while( c<5 ) { printf("hankei?") ; scanf("%g",&hankei) ; menseki = hankei*hankei*3.14 ; printf("menseki = %g\n",menseki) ; c = c+1 ; } for float hankei, menseki ; int c ; for( c = 0 ; c<5 ; c=c+1 ) { printf("hankei?") ; scanf("%g",&hankei) ; menseki = hankei*hankei*3.14 ; printf("menseki = %g\n",menseki) ; } DO WHILE 6.2

46 hanpuku.c 1 hanpuku C++ z: samples C Enter hanpuku.c 1 #include <stdio.h> 2 int main( ) 3 { 4 int c ; 5 for( c=1 ; c<=10 ; c=c+1 ) { 6 printf( "%d\n", c ) ; 7 } 8 return 0 ; 9 } hanpuku.c for 1 Visual Studio C++ (C ).c.cpp

47 6.3. hanpuku.c

48

49 C [ ] 0 x 5 float x[5] ; 3 x[2] 7.2 sample6.c sample7.c 2 5

50 sample7.c sample7.c for() goukei = 0 ; goukei = goukei + data[0] ; goukei = goukei + data[1] ; goukei = goukei + data[2] ; goukei = goukei + data[3] ; goukei = goukei + data[4] ; for() sample8.c if switch case

51 a b 1. a>b a b a b 2. a b a 3. a a 0 b a b C gcd.c

52 52 8 (1) a <= b Yes No c=a; a=b; b=c; (2) a=a%b ; (3) a!= 0 Yes (4) No b 8.1: 1 #include <stdio.h> 2 int main( ) 3 { 4 int a, b, c ; 5 printf("a? ") ; scanf("%d",&a) ; 6 printf("b? ") ; scanf("%d",&b) ; 7 printf("%d %d ",a,b) ; 8 do { 9 if( a<=b ) { c=a ; a=b ; b=c ; } /* 1. */ 10 a = a%b ; /* 2. */ 11 } while( a>0 ) ; /* 3. */ 12 printf( " %d \n", b ) ; /* 4. */ 13 return 0 ; 14 }

53 n if n log 2 n 100 log = 6.64 n x 1,x 2,,x n 1. i i 1 2. x i x n i min 3. i i min x i x imin 4. i 1 5. i<n i = n 1. i min i min i 2. j j i x j <x imin i min j

54 j 1 5. j<n j = n i min C

55 if 8.2. sample9.c sample9.c C i for() i = 1 No i <= n Yes imin = i j for() j = i+1 No j <= n Yes x[j-1] < x[imin-1] Yes if imin = j j = j+1 i = i+1 No i!= imin Yes x[imin-1] x[i-1] No 8.2:

56 for( i=1 ; ; ) { imin = i ; for( j = i+1 ; ; ) { if( ) ; } if( ) { xdummy = x[i-1] ; x[i-1] = x[imin-1] ; x[imin-1] = xdummy ; } } 8.3

57 C ftest1.c 81 fopen fscanf fclose FILE FILE FILE *fp ; * scanf fscanf int kosuu ; fscanf("nyuuryokufairu", "%d", &kosuu) ; /* */ C FILE

58 58 9 int kosuu ; FILE *fp ; fscanf(fp, "%d", &kosuu) ; /* */ fopen FILE int kosuu ; FILE *fp ; fp = fopen("nyuuryokufairu", "r") ; fscanf(fp, "%d", &kosuu) ; /* */ fopen 1 fscanf OS 2 fclose FILE int kosuu ; FILE *fp ; fp = fopen("nyuuryokufairu", "r") ; fscanf(fp, "%d", &kosuu) ;... /* fscanf */... fclose(fp) ; ftest1.c fscanf() 2 fscanf n III 1, stream 2

59 9.2. ftest1.c ftest1.c Windows ftest1.c ftest1.c z: samples test.txt

60

61 a a C ftest2.c ftest1.c ftest2.c main 10.2 ftest1.c ftest2.c C struct

62 ftest3.c ftest2.c struct ftest3.c

63 C C

64

65 II

66

67 67 12

68 sample1.c 1 /* sample1.c: */ 2 3 /* */ 4 /* 1: */ 5 /* 2: */ 6 /* 3: */ 7 /* 4: ( ) */ 8 /* 5: */ 9 10 /* 11 */ /* #include */ 14 /* stdio.h */ 15 #include <stdio.h> /* 18 int ( ) 19 main ( ) 23 { } 26 */ int main( ) 29 { 30 /* printf */ 31 /* " " \n 32 ( 33 ) \n */ 34 printf("this is a sample program.\n") ; /* 0 ( 37 ) */ 38 return 0 ; 39 }

69 sample2.c 1 /* sample2.c: */ 2 3 /* */ 4 /* 1: ( ) */ 5 /* 2: */ 6 /* 3: */ 7 8 #include <stdio.h> 9 10 int main() 11 { 12 /* float */ 14 float teihen, takasa, menseki ; 15 /* int */ /* */ 18 /* teihen 6 */ 19 teihen = 6 ; 20 /* 4 */ 21 takasa = 4 ; /* */ 24 menseki = teihen * takasa / 2 ; /* --- */ 27 /* printf */ 30 /* %g float sample1.c int %d */ 35 printf( "Menseki = %g\n", menseki ) ; return 0 ; 38 }

70 sample3.c 1 /* sample3.c: */ 2 3 #include <stdio.h> 4 5 /* */ 6 /* 1: scanf */ 7 /* 2: if else */ 8 9 int main( ) 10 { 11 float a,b,c ; printf(" \n") ; printf(" " ) ; 16 /* --- scanf */ 17 /* scanf ( ) */ 20 scanf( "%g", &a ) ; 21 /* %g float int %d 22 & */ 23 /* */ printf(" ") ; scanf( "%g", &b ) ; 26 printf(" ") ; scanf( "%g", &c ) ; /* */ 29 printf("a,b,c=%g,%g,%g\n",a,b,c) ; /* if */ 32 if( a<=0 b<=0 c<=0 33 a+b<=c a+c<=b b+c<=a ) { 34 printf(" \n") ; 35 return 0 ; /* */ 36 } /* if */ 39 if( a==b && b==c ) { 40 printf(" \n") ; 41 } 42 else if( a==b b==c c==a ) { 43 printf(" \n") ; 44 } 45 else { 46 printf(" \n") ; 47 } 48

71 return 0 ; 50 }

72 sample4.c 1 /* sample4.c: */ 2 3 /* */ 4 /* 1: scanf */ 5 /* 2: if else */ 6 /* 3: srand() rand() */ 7 8 #include <stdio.h> 9 #include <stdlib.h> /* srand(),rand() */ 10 #include <time.h> /* time() */ int main( ) 13 { 14 int your_hand, my_hand ; printf("...\n\n") ; /* */ 19 srand( time(null) ) ; /* time() */ 20 /* 0,1,2 */ 21 my_hand = rand() % 3 ; /* % ( ) */ printf(" \n\n") ; /* scanf */ 26 printf(" \n") ; 27 printf(" [0: 1: 2: ] -> ") ; 28 scanf("%d", &your_hand) ; if( your_hand < 0 your_hand >2 ) { 31 printf(" \n") ; 32 return 1 ; /* OS (1 ) */ 33 } if( my_hand == your_hand ) { 36 printf("\n \n") ; 37 } 38 else if( my_hand == 0 ) { 39 if( your_hand == 1 ) printf("\n \n") ; 40 else printf("\n \n") ; 41 } 42 else if( my_hand == 1 ) { 43 if( your_hand == 2 ) printf("\n \n") ; 44 else printf("\n \n") ; 45 } 46 else { 47 if( your_hand == 0 ) printf("\n \n") ; 48 else printf("\n \n") ;

73 } return 0 ; 52 }

74 sample5.c 1 /* sample5.c: */ 2 3 #include <stdio.h> 4 5 /* : 9 1) scanf, printf 10 2) 11 3) * ( )* (cm) -> (kg) -> */ int main( ) 21 { 22 /* ( ) */ /* */ /* ( (kg) (cm)) */ /* ( ) 33 */ /* */ return 0 ; 40 }

75 sample6.c 1 /* sample6.c: */ 2 3 /* */ 4 /* 1: */ 5 6 #include <stdio.h> 7 8 int main( ) 9 { 10 /* 5 */ 11 float data1, data2, data3, data4, data5 ; 12 float goukei ; printf("5 \n") ; 15 printf(" 1 ") ; scanf("%g",&data1) ; 16 printf(" 2 ") ; scanf("%g",&data2) ; 17 printf(" 3 ") ; scanf("%g",&data3) ; 18 printf(" 4 ") ; scanf("%g",&data4) ; 19 printf(" 5 ") ; scanf("%g",&data5) ; goukei = data1+data2+data3+data4+data5 ; 22 printf(" %g \n",goukei) ; return 0 ; 25 }

76 sample7.c 1 /* sample7.c: */ 2 3 /* */ 4 /* 1: */ 5 /* 2: */ 6 /* 3: */ 7 8 /* 9 */ #include <stdio.h> int main( ) 14 { 15 /* 5 */ 16 float data[5] ; /* [ ] */ 17 float goukei ; /* [ ] */ 20 printf("5 \n") ; 21 printf(" 1 ") ; scanf("%g",&data[0]) ; /* 0 */ 22 printf(" 2 ") ; scanf("%g",&data[1]) ; 23 printf(" 3 ") ; scanf("%g",&data[2]) ; 24 printf(" 4 ") ; scanf("%g",&data[3]) ; 25 printf(" 5 ") ; scanf("%g",&data[4]) ; goukei = data[0]+data[1]+data[2]+data[3]+data[4] ; 28 printf(" %g \n",goukei) ; return 0 ; 31 }

77 sample8.c 1 /* sample8.c: */ 2 3 /* */ 4 /* 1: */ 5 /* 2: */ 6 /* 3: switch case */ 7 8 #include <stdio.h> 9 #include <stdlib.h> 10 #include <time.h> int main( ) 13 { 14 int your_hand, my_hand ; 15 /* */ 16 /* 0,1,2 3 x : 0: 1: */ 27 int shouhai[3][3] = { { 0, 1,-1 }, /* [0][0] [0][1] [0][2] */ 28 { -1, 0, 1 }, /* [1][0] [1][1] [1][2] */ 29 { 1,-1, 0 } } ; /* [2][0] [2][1] [2][2] */ 30 /* 31 = ; */ srand( time(null) ) ; 36 printf("...\n\n") ; 37 my_hand = rand() % 3 ; 38 printf(" \n\n") ; 39 printf(" \n") ; 40 printf(" [0: 1: 2: ] -> ") ; 41 scanf("%d", &your_hand) ; 42 if( your_hand < 0 your_hand >2 ) { 43 printf(" \n") ; 44 return 1 ; 45 } /* switch */ 48 switch( shouhai[your_hand][my_hand] ) {

78 case -1: printf(" \n") ; break ; 50 case 0: printf(" \n") ; break ; 51 case 1: printf(" \n") ; break ; 52 default: printf(" \n") ; 53 } return 0 ; 56 }

79 sample9.c 1 /* sample9.c: */ 2 3 /* */ 4 /* 1: */ 5 /* 2: */ 6 /* 3: */ 7 8 #include <stdio.h> 9 10 int main( ) 11 { 12 float x[5], xdummy ; 13 int n, i, j, imin ; n = 5 ; 16 /* */ 17 printf("%d \n", n) ; 18 for( i=1 ; i<=n ; i=i+1 ) { 19 printf("%d -> ", i) ; 20 scanf("%g", &x[i-1]) ; 21 } /* */ 24 printf(" ") ; 25 for( i=1 ; i<=n ; i=i+1 ) printf(" %g",x[i-1]) ; 26 printf(" \n") ; /* 29 */ /* */ 33 printf(" ") ; 34 for( i=1 ; i<=n ; i=i+1 ) printf(" %g",x[i-1]) ; 35 printf(" \n") ; return 0 ; 38 }

80 txt Windows z: samples test.txt Asai 90 Mori 70 Kanai 100 Hori 80

81 ftest1.c 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 #define NMAX char namae[nmax][21] ; 7 float tokuten[nmax] ; 8 int n ; 9 10 int main( ) 11 { 12 char fairumei[100] ; 13 int k ; 14 FILE *fp ; printf("enter the name of datafile: ") ; scanf("%s",fairumei) ; /* Open the file */ 19 fp=fopen(fairumei,"r") ; 20 /* Error check */ 21 if( fp == NULL ) { 22 printf("can t open file %s\n",fairumei) ; 23 return 1 ; 24 } 25 /* Loop until encounter EOF */ 26 n = 0 ; 27 while( n<nmax && 28 fscanf(fp,"%s %g",namae[n],&tokuten[n])==2 ) 29 n = n+1 ; 30 /* Close the file */ 31 fclose(fp) ; printf("number of data:%3d\n", n) ; 34 printf("%3s %-16s%8s\n", "No.", "Name", "Tokuten") ; 35 for( k=0 ; k<n ; k=k+1 ) 36 printf("%3d %-16s%8.2f\n", k+1, namae[k], tokuten[k]) ; return 0 ; 39 }

82 ftest2.c main 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 #define NMAX char fairumei[100] ; 7 char namae[nmax][21] ; 8 float tokuten[nmax] ; 9 int n ; void ReadFileName( ) 12 { 13 printf("enter the name of datafile: ") ; scanf("%s",fairumei) ; 14 } int ReadFile( ) 17 { 18 FILE *fp ; /* Open the file */ 21 fp=fopen(fairumei,"r") ; 22 /* Error check */ 23 if( fp == NULL ) { 24 printf("can t open file %s\n",fairumei) ; 25 return 1 ; /* fail */ 26 } 27 /* Loop until encounter EOF */ 28 n = 0 ; 29 while( n<nmax && 30 fscanf(fp,"%s %g",namae[n],&tokuten[n])==2 ) 31 n = n+1 ; 32 /* Close the file */ 33 fclose(fp) ; 34 return 0 ; /* success */ 35 } void PrintList( ) 38 { 39 int k ; 40 printf("number of data:%3d\n", n) ; 41 printf("%3s %-16s%8s\n", "No.", "Name", "Tokuten") ; 42 for( k=0 ; k<n ; k=k+1 ) 43 printf("%3d %-16s%8.2f\n", k+1, namae[k], tokuten[k]) ; 44 } int main( ) 47 {

83 /* get name of the datafile */ 49 ReadFileName() ; 50 /* read data */ 51 if( ReadFile() == 1 ) return 1 ; /* if fail, exit */ 52 /* print list of data */ 53 PrintList() ; return 0 ; 56 }

84 ftest3.c 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 #define NMAX struct Kojin { 7 char namae[21] ; 8 float tokuten ; 9 } ; char fairumei[100] ; 12 struct Kojin KojinData[NMAX] ; 13 int n ; void ReadFileName( ) 16 { 17 printf("enter the name of datafile: ") ; scanf("%s",fairumei) ; 18 } int ReadFile( ) 21 { 22 FILE *fp ; /* Open the file */ 25 fp=fopen(fairumei,"r") ; 26 /* Error check */ 27 if( fp == NULL ) { 28 printf("can t open file %s\n",fairumei) ; 29 return 1 ; /* fail */ 30 } 31 /* Loop until encounter EOF */ 32 n = 0 ; 33 while( n<nmax && 34 fscanf(fp,"%s %g", 35 KojinData[n].namae,&KojinData[n].tokuten)==2 ) 36 n = n+1 ; 37 /* Close the file */ 38 fclose(fp) ; 39 return 0 ; /* success */ 40 } void PrintList( ) 43 { 44 int k ; 45 printf("number of data:%3d\n", n) ; 46 printf("%3s %-16s%8s\n", "No.", "Name", "Tokuten") ;

85 for( k=0 ; k<n ; k=k+1 ) 48 printf("%3d %-16s%8.2f\n", k+1, KojinData[k].namae, KojinData[k].tokuten) ; 49 } int main( ) 52 { 53 /* get name of the datafile */ 54 ReadFileName() ; 55 /* read data */ 56 if( ReadFile() == 1 ) return 1 ; /* if fail, exit */ 57 /* print list of data */ 58 PrintList() ; return 0 ; 61 }

86

87 sample5.c (km) ( ) (km/h) n v 0 (m/ ) ( 0) t v (m/ ) y (m) ( 9.8m/ 2 ) 13.2 ax + b =0 x a b 1. a =0 b =0 2. a =0 b 0 3. a (1) for()

88 (2) sample8.c for() while() goto 13.5

89 III C

90

91 auto break case char continue default double else enum extern float for if int long register short signed sizeof static struct switch typedef union unsigned void while " char " \ "abc" " " 1 a z A Z 2 0 9

92 Tab Enter /* */ a f A F x 0X x12 0xAB 0X16-0xa8 1 ASCII \ 3 8 \x e E e6 4.1e = =

93 : ASCII a a 97 \ \x x10 16 \\ \ 92 \ 39 \a Alert 7 \b Back Space 8 Back Space \t TAB 9 Tab \n New Line 10 \f Form Feed 12 \r Return : *3 6 5/3 1 5%

94 : == 5==3 0!= 5!=3 1 < 5<3 0 > 5>3 1 <= 5<=3 0 >= 5>=3 1 NOT AND OR :!! 1==2 1 && 5<3 && 1<2 0 1<2 2<3 1 () 1+2 *3 4+6 /7 /8 C

95 a b1 xyz A my_name 1st if My Name kyori / jikan joutei + katei * takasa / C 14.5 float takasa ; short a, b, c ; ;

96 : C 1 char 2 short short int 4 long long int 2 4 int 4 float 6 8 double 15 unsigend unsigned char= (0 255 ) = float takasa, teihen, menseki ; /* */ takasa = 3 ; /* takasa 3 */ teihen = 5 ; /* teihen 5 */ menseki = takasa * teihen / 2 ; /* menseki */ C : C = += -= *= /= %=

97 ; { } if if if x < 0 x = -x ; if 1 else 2 if x < 0 y = -x ; else y = x ; 14.1 if ( ) if ( ) False True False True ( ) 1( ) 2( ) 14.1: if

98 printf printf printf, ; printf) ( ) printf %, : %c char %hd 10 short %ld 10 long %d 10 int %f 10 float %g 10 float %lf 10 double %lg 10 double %s char int a ; a = 3 ; printf "a = %d\n", a ; a = 3

99 scanf scanf scanf, ; scanf % &, : %c char %hd 10 short %ld 10 long %d 10 int %f 10 float %g 10 float %lf 10 double %lg 10 double int a ; scanf "%d", &a ; a a 123[Enter] [Enter] 54.3

100

101 ( 2) ( ) goto goto if : ; 1 goto... :... hajime: goto hajime ; do while REPEAT UNTIL do while ( ) do while goto

102 float a ;... do { scanf("%g",&a) ; } while( a<0 ) ; a while ( ) True False 15.1: do while while DO WHILE while ( ) for while 15.2 float a ;... while( 1 ) { scanf("%g",&a) ; }

103 15.1. ( 2) 103 False True ( ) 15.2: while for for ( 1 ; 2 ; 3 ) for ( ) ; int x ; for ( x=1 ; x<=10 ; x+=1 ) printf("x=%d\n",x) ;

104 False True ( ) 15.3: for() break break for while do while switch case switch ( ) { case 1 : 1 break; case 2 : 2 break; case n : n break; default: } break break

105 == 1 True 1( ) break False break == 2 True 2( ) break False break (default: ) ( ) : switch case [ ] ( ) f[n+2] = f[n]+f[n+1] ; 3 ( ) [ ( ) ] ; [ ] float MatrixA[3][5] ; /* 3x5 */ 3 Dynamic Allocation

106 #include C 15.1 stdio.h string.h ctype.h math.h stdlib.h time.h 15.1: ( ) stdio.h stdio.h string.h char

107 : stdio.h printf(fmt,data...) scanf(fmt,data...) fopen(name,mode) fclose(file) fprintf(file,fmt,data...) fscanf(file,fmt,data...) fmt name mode (char ) data ( ) file fopen() FILE strcat(s,t) strcpy(s,t) strchr(s,c) 15.3: string.h s t s t s c ( NULL) strcmp(s,t) s t ( 0) strlen(s) s ( \0 ) s t char c int strcat(),strcpy(),strchr() char strcmp(),strlen() int ctype.h C math.h C

108 : ctype.h isalpha(c) isupper(c) islower(c) isdigit(c) isalnum(c) isspace(c) toupper(c) c (a-za-z) c c c c c c tolower(c) c c int int 15.5: math.h sin(x) cos(x) tan(x) exp(x) log(x) log10(x) sqrt(x) pow(x,y) fabs(x) ceil(x) x ( ) x ( ) x ( ) e x x x y x x floor(x) x x double double

109 C FILE FILE fopen fopen fopen 15.6 fopen NULL 5 NULL stdio.h 0 NULL if scanf fscanf printf fprintf 4 FILE 5

110 : fopen ( ) r w a b rb t rt b t UNIX MS-DOS Windows \r \n Macintosh \r UNIX \n b t fclose fclose char atom_symbol[20][3] ; /* 20 */ short atom_number[20] ; /* */ float atom_weight[20] ; /* */ C struct struct { /* */ 6

111 ) } ; struct atom { char symbol[3] ; short number ; float weight ; } ; int float 20 struct atom atoms[20] ; struct atom #define typedef 7 typedef ; typedef struct atom ATOM ; ATOM atoms[20] ; atoms[0] = atoms[1] ;. atoms[0] atoms[0].weight 7 #define #define PI typedef

112

113 113 A C [10] [3] [6] [5] [11] [12] [13] [7]

114

115 115 B [4] C Kernighan [2] [1] [8] UNIX C C++ C [9] C OS

116 116 B Web 10 Web HTML XML CGI Java C

117 117 [1] Andrew Binstock, JohnRex.., [2] Brian W. Kernighan, RobPike.., [3] Brian W. Kernighan, P.J.Plauger. ( )., [4] Brian W. Kernighan, P.J.Plauger.., [5].., [6].., [7]..., [8].., [9].., [10].., [11].., [12].., [13].., 1992.

118 118 BIOS, 19 ENIAC, 19 IPL, 18 OS, see RAM, 18 ROM, 18 C, 21, see, 20, 20, 20, 20, 17, 15, 15, 15, 15, 37 38, 46, 27, 27, 23 24, 24 25, 17, 17, 19, 19, 17, see, 17, 17, 18, 18, see, 18, 18, 18, 18, 18 break, 104 do while, for, 77, 103 goto, 101 if..else.., 70, 97 switch..case.., 77, 104 typedef, 111 while, 102, 69, 93 94, 95 char, 96 double, 96 float, 69, 96 int, 68, 96 long, 96 short, 96 struct, 84,

119 119, 95, 68, 68, 84, 91 95, 95, 69, 77, 81, 96, 68, 92, 92, 69, 75, 76, 105, 97, 97, 97, 97, 95, 106 #define, 81, 111 #include, 68, 21 22, 22, 22, 22, 22, 22, 22, 17, 19, 17, 17, 106 ctype.h, 108 math.h, 108 stdio.h, 107 string.h, 107, 19, 23, ceil, 108 cos, 108 exp, 108 floor, 108 log, 108 log10, 108 pow, 108 sin, 108 sqrt, 108 tan, 108 rand, 72 srand, 72 time, 72, fclose, 81, 107 fopen, 81, 107 fprintf, 107 fscanf, 81, 107 printf, 68, 98, 107 scanf, 70, 99, 107 isalnum, 108 isalpha, 108 isdigit, 108 islower, 108 isspace, 108 isupper, 108 tolower, 108 toupper, 108 strcat, 107 strchr, 107 strcmp, 107 strcpy, 107 strlen, 107, 23

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング初級 第 13 回 2017 年 7 月 10 日 標準ライブラリ関数 1 標準ライブラリ関数とは 関数には (1) 自分で作る関数 (2) はじめから用意されている関数特に C 言語用用意されているもの : 標準ライブラリ関数 文字列の代入文字列の長さを求める文字列の比較文字列の連結 strcpy strlen strcmp strcat 2 文字列の操作 - 具体例を通して (141

More information

‚æ4›ñ

‚æ4›ñ ( ) ( ) ( ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 (OUS) 9 26 1 / 28 ( ) ( ) ( ) A B C D Z a b c d z 0 1 2 9 (OUS) 9

More information

卒 業 研 究 報 告.PDF

卒 業 研 究 報 告.PDF C 13 2 9 1 1-1. 1-2. 2 2-1. 2-2. 2-3. 2-4. 3 3-1. 3-2. 3-3. 3-4. 3-5. 3-5-1. 3-5-2. 3-6. 3-6-1. 3-6-2. 4 5 6 7-1 - 1 1 1-1. 1-2. ++ Lisp Pascal Java Purl HTML Windows - 2-2 2 2-1. 1972 D.M. (Dennis M Ritchie)

More information

解きながら学ぶC++入門編

解きながら学ぶC++入門編 !... 38!=... 35 "... 112 " "... 311 " "... 4, 264 #... 371 #define... 126, 371 #endif... 369 #if... 369 #ifndef... 369 #include... 3, 311 #undef... 371 %... 17, 18 %=... 85 &... 222 &... 203 &&... 40 &=...

More information

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

untitled

untitled II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}

More information

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 1. 1.1. 1.2. 1 PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 2. 2.1. 2 1 2 C a b N: PC BC c 3C ac b 3 4 a F7 b Y c 6 5 a ctrl+f5) 4 2.2. main 2.3. main 2.4. 3 4 5 6 7 printf printf

More information

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* (

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* ( 2016 2016 07 28 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF : 11011 N N 0 N N 11 1001 N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) 1100100 (2) 1111011 (3) 1110010 (4) 1001011

More information

USB 0.6 https://duet.doshisha.ac.jp/info/index.jsp 2 ID TA DUET 24:00 DUET XXX -YY.c ( ) XXX -YY.txt() XXX ID 3 YY ID 5 () #define StudentID 231

USB 0.6 https://duet.doshisha.ac.jp/info/index.jsp 2 ID TA DUET 24:00 DUET XXX -YY.c ( ) XXX -YY.txt() XXX ID 3 YY ID 5 () #define StudentID 231 0 0.1 ANSI-C 0.2 web http://www1.doshisha.ac.jp/ kibuki/programming/resume p.html 0.3 2012 1 9/28 0 [ 01] 2 10/5 1 C 2 3 10/12 10 1 2 [ 02] 4 10/19 3 5 10/26 3 [ 03] 6 11/2 3 [ 04] 7 11/9 8 11/16 4 9 11/30

More information

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D II 8 2003 11 12 1 6 ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko

More information

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * * 2015 2015 07 30 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) +

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2018 2018 08 02 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF N N y N x N xy yx : yxxyxy N N x, y N (parse tree) (1) yxyyx (2) xyxyxy (3) yxxyxyy (4) yxxxyxxy N y N x N yx

More information

10

10 2: http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp 10 : 0 1 2 n 2 n 0 1 1 0 1 0 0 1 (2) = 105 1 = 8 1 2 8 = 256 0 9 105 i 106 j 256 2 1 #include int main(void)

More information

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

untitled

untitled C -1 - -2 - concept lecture keywords FILE, fopen, fclose, fscanf, fprintf, EOF, r w a, typedef gifts.dat Yt JZK-3 Jizake tsumeawase 45 BSP-15 Body soap set 3 BT-2 Bath towel set 25 TEA-2 Koutya

More information

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B A/B (2018/10/19) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 10 19 A/B 1 2018 10 19 2 1 1 1.1 OHP.................................... 1

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2017 2017 08 03 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF X [ S ] a S S ; X X X, S [, a, ], ; BNF X (parse tree) (1) [a;a] (2) [[a]] (3) [a;[a]] (4) [[a];a] : [a] X 2 222222

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

超初心者用

超初心者用 3 1999 10 13 1. 2. hello.c printf( Hello, world! n ); cc hello.c a.out./a.out Hello, world printf( Hello, world! n ); 2 Hello, world printf n printf 3. ( ) int num; num = 100; num 100 100 num int num num

More information

解きながら学ぶC言語

解きながら学ぶC言語 printf 2-5 37 52 537 52 printf("%d\n", 5 + 37); 5370 source program source file.c ex00.c 0 comment %d d 0 decimal -2 -p.6 3-2 5 37 5 37-22 537 537-22 printf("537%d\n", 5-37); function function call ( )argument,

More information

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç C (3) if else switch AND && OR (NOT)! 1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 1 BMI BMI BMI = 10

More information

Microsoft Word - C.....u.K...doc

Microsoft Word - C.....u.K...doc C uwêííôöðöõ Ð C ÔÖÐÖÕ ÐÊÉÌÊ C ÔÖÐÖÕÊ C ÔÖÐÖÕÊ Ç Ê Æ ~ if eíè ~ for ÒÑÒ ÌÆÊÉÉÊ ~ switch ÉeÍÈ ~ while ÒÑÒ ÊÍÍÔÖÐÖÕÊ ~ 1 C ÔÖÐÖÕ ÐÊÉÌÊ uê~ ÏÒÏÑ Ð ÓÏÖ CUI Ô ÑÊ ÏÒÏÑ ÔÖÐÖÕÎ d ÈÍÉÇÊ ÆÒ Ö ÒÐÑÒ ÊÔÎÏÖÎ d ÉÇÍÊ

More information

ohp08.dvi

ohp08.dvi 19 8 ( ) 2019.4.20 1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: 2 (2) NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( 2) 3 (3) head cur tail head cur prev data

More information

9 8 7 (x-1.0)*(x-1.0) *(x-1.0) (a) f(a) (b) f(a) Figure 1: f(a) a =1.0 (1) a 1.0 f(1.0)

9 8 7 (x-1.0)*(x-1.0) *(x-1.0) (a) f(a) (b) f(a) Figure 1: f(a) a =1.0 (1) a 1.0 f(1.0) E-mail: takio-kurita@aist.go.jp 1 ( ) CPU ( ) 2 1. a f(a) =(a 1.0) 2 (1) a ( ) 1(a) f(a) a (1) a f(a) a =2(a 1.0) (2) 2 0 a f(a) a =2(a 1.0) = 0 (3) 1 9 8 7 (x-1.0)*(x-1.0) 6 4 2.0*(x-1.0) 6 2 5 4 0 3-2

More information

kiso2-06.key

kiso2-06.key 座席指定があります Linux を起動して下さい 第6回 計算機基礎実習II 計算機基礎実習II 2018 のウェブページか ら 以下の課題に自力で取り組んで下さい 第5回の復習課題(rev05) 第6回の基本課題(base06) 第5回課題の回答例 ex05-2.c 1. キーボードから整数値 a を入力すると a*a*a の値を出力することを繰り返すプログラムを作成しなさい 2. ただし 入力された

More information

/* sansu1.c */ #include <stdio.h> main() { int a, b, c; /* a, b, c */ a = 200; b = 1300; /* a 200 */ /* b 200 */ c = a + b; /* a b c */ }

/* sansu1.c */ #include <stdio.h> main() { int a, b, c; /* a, b, c */ a = 200; b = 1300; /* a 200 */ /* b 200 */ c = a + b; /* a b c */ } C 2: A Pedestrian Approach to the C Programming Language 2 2-1 2.1........................... 2-1 2.1.1.............................. 2-1 2.1.2......... 2-4 2.1.3..................................... 2-6

More information

新・明解C言語 ポインタ完全攻略

新・明解C言語 ポインタ完全攻略 2 1-1 1-1 /* 1-1 */ 1 int n = 100; int *p = &n; printf(" n %d\n", n); /* n int */ printf("*&n %d\n", *&n); /* *&n int */ printf(" p %p\n", p); /* p int * */ printf("&*p %p\n", &*p); /* &*p int * */ printf("sizeof(n)

More information

r08.dvi

r08.dvi 19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev

More information

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D 6 2019 5 14 6.1 Minimum C....................... 6 1 6.2....................................... 6 7 6.1 Minimum C Minimum C BNF T okenseq W hite Any Digit ::= 0 1 2... 9. Number ::= Digit Digit. Alphabet

More information

ohp03.dvi

ohp03.dvi 19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0

More information

C 2 / 21 1 y = x 1.1 lagrange.c 1 / Laglange / 2 #include <stdio.h> 3 #include <math.h> 4 int main() 5 { 6 float x[10], y[10]; 7 float xx, pn, p; 8 in

C 2 / 21 1 y = x 1.1 lagrange.c 1 / Laglange / 2 #include <stdio.h> 3 #include <math.h> 4 int main() 5 { 6 float x[10], y[10]; 7 float xx, pn, p; 8 in C 1 / 21 C 2005 A * 1 2 1.1......................................... 2 1.2 *.......................................... 3 2 4 2.1.............................................. 4 2.2..............................................

More information

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1: 005 9 7 1 1.1 1 Hello World!! 5 p r i n t f ( H e l l o World!! \ n ) ; 7 return 0 ; 8 } 1: 1 [ ] Hello World!! from Akita National College of Technology. 1 : 5 p r i n t f ( H e l l o World!! \ n ) ;

More information

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 12 11 p.1/33 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20

More information

Informatics 2014

Informatics 2014 C 計算機の歴史 手回し計算機 新旧のソロバン バベッジの階差機関 スパコン ENIAC (1946) パソコン 大型汎用計算機 電卓 現在のコンピュータ Input Output Device Central Processing Unit I/O CPU Memory OS (Operating System) OS Windows 78, Vista, XP Windows Mac OS X

More information

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l C/C++ 2007 6 18 1 C STL(1) 2 1.1............................................... 2 1.2 stdio................................................ 3 1.3.......................................... 10 2 11 2.1 sizeof......................................

More information

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology I117 8 1 School of Information Science, Japan Advanced Institute of Science and Technology : CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and

More information

joho09.ppt

joho09.ppt s M B e E s: (+ or -) M: B: (=2) e: E: ax 2 + bx + c = 0 y = ax 2 + bx + c x a, b y +/- [a, b] a, b y (a+b) / 2 1-2 1-3 x 1 A a, b y 1. 2. a, b 3. for Loop (b-a)/ 4. y=a*x*x + b*x + c 5. y==0.0 y (y2)

More information

r03.dvi

r03.dvi 19 ( ) 019.4.0 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void... argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0 a a \0 b b b \0 c c c \0 1: // argdemo1.c ---

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

‚æ2›ñ C„¾„ê‡Ìš|

‚æ2›ñ C„¾„ê‡Ìš| I 8 10 10 I ( 6 ) 10 10 1 / 23 1 C ( ) getchar(), gets(), scanf() ( ) putchar(), puts(), printf() 1 getchar(), putchar() 1 I ( 6 ) 10 10 2 / 23 1 (getchar 1 1) 1 #include 2 void main(void){ 3 int

More information

Informatics 2015

Informatics 2015 C 計算機の歴史 新旧のソロバン バベッジの階差機関 19C前半 手回し計算機 19C後半 20C後半 スパコン 1960年代 ENIAC (1946) 大型汎用計算機 1950年代 1980年代 電卓 1964 パソコン 1970年代 現在のコンピュータ Input Output Device Central Processing Unit I/O CPU Memory OS (Operating

More information

ex14.dvi

ex14.dvi 1,, 0, b (b b 2 b ) n k n = n j b j, (0 n j b 1), n =(n k n k 1...n 1 n 0 ) b, n j j j +1, 0,...,b 1 (digit). b b, n b 1 ñ, ñ = k (b 1 n j )b j b N, n b n, n = b N n, n =ñ+1 b N, n m n + m (mod b N ),

More information

lexex.dvi

lexex.dvi (2018, c ) http://istksckwanseiacjp/ ishiura/cpl/ 4 41 1 mini-c lexc,, 2 testlexc, lexc mini-c 1 ( ) mini-c ( ) (int, char, if, else, while, return 6 ) ( ) (+, -, *, /, %, &, =, ==,!=, >, >=,

More information

untitled

untitled II 4 Yacc Lex 2005 : 0 1 Yacc 20 Lex 1 20 traverse 1 %% 2 [0-9]+ { yylval.val = atoi((char*)yytext); return NUM; 3 "+" { return + ; 4 "*" { return * ; 5 "-" { return - ; 6 "/" { return / ; 7 [ \t] { /*

More information

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v 1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );

More information

ゲームエンジンの構成要素

ゲームエンジンの構成要素 cp-3. 計算 (C プログラムの書き方を, パソコン演習で学ぶシリーズ ) https://www.kkaneko.jp/cc/adp/index.html 金子邦彦 1 本日の内容 例題 1. 自由落下距離四則演算例題 2. 三角形の面積浮動小数の変数, 入力文, 出力文, 代入文例題 3. sin 関数による三角形の面積ライブラリ関数 2 今日の到達目標 プログラムを使って, 自分の思い通りの計算ができるようになる

More information

コンピュータ概論

コンピュータ概論 4.1 For Check Point 1. For 2. 4.1.1 For (For) For = To Step (Next) 4.1.1 Next 4.1.1 4.1.2 1 i 10 For Next Cells(i,1) Cells(1, 1) Cells(2, 1) Cells(10, 1) 4.1.2 50 1. 2 1 10 3. 0 360 10 sin() 4.1.2 For

More information

C ( ) C ( ) C C C C C 1 Fortran Character*72 name Integer age Real income 3 1 C mandata mandata ( ) name age income mandata ( ) mandat

C ( ) C ( ) C C C C C 1 Fortran Character*72 name Integer age Real income 3 1 C mandata mandata ( ) name age income mandata ( ) mandat C () 14 5 23 C () C C C C C 1 Fortran Character*72 name Integer age Real income 3 1 C 1.1 3 7 mandata mandata () name age income mandata () mandata1 1 #include struct mandata char name[51];

More information

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return 0; 戻り値 1: main() 2.2 C main

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf(hello World!!\n); return 0; 戻り値 1: main() 2.2 C main C 2007 5 29 C 1 11 2 2.1 main() 1 FORTRAN C main() main main() main() 1 return 1 1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return

More information

Informatics 2010.key

Informatics 2010.key http://math.sci.hiroshima-u.ac.jp/ ~ryo/lectures/informatics2010/ 1 2 C ATM etc. etc. (Personal Computer) 3 4 Input Output Device Central Processing Unit I/O CPU Memory 5 6 (CPU),,... etc. C, Java, Fortran...

More information

C言語によるアルゴリズムとデータ構造

C言語によるアルゴリズムとデータ構造 Algorithms and Data Structures in C 4 algorithm List - /* */ #include List - int main(void) { int a, b, c; int max; /* */ Ÿ 3Ÿ 2Ÿ 3 printf(""); printf(""); printf(""); scanf("%d", &a); scanf("%d",

More information

18 C ( ) hello world.c 1 #include <stdio.h> 2 3 main() 4 { 5 printf("hello World\n"); 6 } [ ] [ ] #include <stdio.h> % cc hello_world.c %./a.o

18 C ( ) hello world.c 1 #include <stdio.h> 2 3 main() 4 { 5 printf(hello World\n); 6 } [ ] [ ] #include <stdio.h> % cc hello_world.c %./a.o 18 C ( ) 1 1 1.1 hello world.c 5 printf("hello World\n"); 6 } [ ] [ ] #include % cc hello_world.c %./a.out Hello World [a.out ] % cc hello_world.c -o hello_world [ ( ) ] (K&R 4.1.1) #include

More information

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2  2 B R b I 4 003 4 30 1 ASCII ( ) 0 17 0 NUL 16 DLE SP 0 @ P 3 48 64 80 96 11 p 1 SOH 17 DC1! 1 A Q a 33 49 65 81 97 113 q STX 18 DC " B R b 34 50 66 8 98 114 r 3 ETX 19 DC3 # 3 C S c 35 51 67 83 99 115 s 4 EOT

More information

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

[1] #include<stdio.h> main() { printf(hello, world.); return 0; } (G1) int long int float ± ± [1] #include printf("hello, world."); (G1) int -32768 32767 long int -2147483648 2147483647 float ±3.4 10 38 ±3.4 10 38 double ±1.7 10 308 ±1.7 10 308 char [2] #include int a, b, c, d,

More information

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C 1 6 9 1 main main 1 NULL NULL 1 15 23 25 48 26 30 32 36 38 43 45 47 50 52 for 2 (a) 2 2 1 Yacc 2 (b) 2 3 yytext tmp2 ("") tmp2->next->word tmp2 yytext tmp2->next->word

More information

新・明解C言語 実践編

新・明解C言語 実践編 第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include

More information

1 4 2 EP) (EP) (EP)

1 4 2 EP) (EP) (EP) 2003 2004 2 27 1 1 4 2 EP) 5 3 6 3.1.............................. 6 3.2.............................. 6 3.3 (EP)............... 7 4 8 4.1 (EP).................... 8 4.1.1.................... 18 5 (EP)

More information

問 2 ( 型変換 ) 次のプログラムを実行しても正しい結果が得られない 何が間違いかを指摘し 正しく修正せよ ただし int サイズが 2 バイト long サイズが 4 バイトの処理系での演算を仮定する #include <stdio.h> int main( void ) { int a =

問 2 ( 型変換 ) 次のプログラムを実行しても正しい結果が得られない 何が間違いかを指摘し 正しく修正せよ ただし int サイズが 2 バイト long サイズが 4 バイトの処理系での演算を仮定する #include <stdio.h> int main( void ) { int a = 問 1 配列の宣言整数型配列 data1 にデータが初期設定されている この配列 data1 のデータを下図のように 整数型配列 data2 に代入しなさい また data2 の内容を printf( "data2[0] = %d\n", data2[0] ); printf( "data2[5] = %d\n", data2[5] ); を用いて出力しなさい 実行結果 data2[0] = 76

More information

新・明解C言語で学ぶアルゴリズムとデータ構造

新・明解C言語で学ぶアルゴリズムとデータ構造 第 1 章 基本的 1 n 141 1-1 三値 最大値 algorithm List 1-1 a, b, c max /* */ #include int main(void) { int a, b, c; int max; /* */ List 1-1 printf("\n"); printf("a"); scanf("%d", &a); printf("b"); scanf("%d",

More information

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 11 20 p.1/34 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20

More information

program.dvi

program.dvi 2001.06.19 1 programming semi ver.1.0 2001.06.19 1 GA SA 2 A 2.1 valuename = value value name = valuename # ; Fig. 1 #-----GA parameter popsize = 200 mutation rate = 0.01 crossover rate = 1.0 generation

More information

1-4 int a; std::cin >> a; std::cout << "a = " << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >>

1-4 int a; std::cin >> a; std::cout << a =  << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >> 1 C++ 1.1 C C++ C++ C C C++ 1.1.1 C printf() scanf() C++ C hello world printf() 1-1 #include printf( "hello world\n" ); C++ 1-2 std::cout

More information

C V C 6 1 6.1.............................. 1 6.......................... 3 6.3..................... 5 6.4 NULL............................. 8 6.5......................... 9 6.6..............................

More information

char int float double の変数型はそれぞれ 文字あるいは小さな整数 整数 実数 より精度の高い ( 数値のより大きい より小さい ) 実数 を扱う時に用いる 備考 : 基本型の説明に示した 浮動小数点 とは数値を指数表現で表す方法である 例えば は指数表現で 3 書く

char int float double の変数型はそれぞれ 文字あるいは小さな整数 整数 実数 より精度の高い ( 数値のより大きい より小さい ) 実数 を扱う時に用いる 備考 : 基本型の説明に示した 浮動小数点 とは数値を指数表現で表す方法である 例えば は指数表現で 3 書く 変数 入出力 演算子ここまでに C 言語プログラミングの様子を知ってもらうため printf 文 変数 scanf 文 if 文を使った簡単なプログラムを紹介した 今回は変数の詳細について習い それに併せて使い方が増える入出力処理の方法を習う また 演算子についての復習と供に新しい演算子を紹介する 変数の宣言プログラムでデータを取り扱う場合には対象となるデータを保存する必要がでてくる このデータを保存する場所のことを

More information

PowerPoint Presentation

PowerPoint Presentation p.130 p.198 p.208 2 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i i < NUM; i++ ) ) if if ( weight[i] > max ) max = weight[i]: if if ( weight[i] < min ) min = weight[i]: weight

More information

+ +

+ + + + 2 1 1 1.1................................ 1 1.2........................... 2 1.3............................. 2 1.4 ( ).................. 2 1.5........................ 3 1.6...................... 3

More information

comment.dvi

comment.dvi ( ) (sample1.c) (sample1.c) 2 2 Nearest Neighbor 1 (2D-class1.dat) 2 (2D-class2.dat) (2D-test.dat) 3 Nearest Neighbor Nearest Neighbor ( 1) 2 1: NN 1 (sample1.c) /* -----------------------------------------------------------------

More information

ex12.dvi

ex12.dvi 1 0. C, char., char, 0,. C, ("),., char str[]="abc" ; str abc.,, str 4. str 3. char str[10]="abc" ;, str 10, str 3., char s[]="abc", t[10] ;, t = s. ASCII, 0x00 0x7F, char., "abc" 3, 1. 1 8 256, 2., 2

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() 2 double *a[ ]; double 1 malloc() double 1 malloc() free() 3 #include #include

More information

Microsoft PowerPoint - 14Chap17.ppt

Microsoft PowerPoint - 14Chap17.ppt 17.1 do-while 文 p.161 例 17.1.1 p.22 例 5.1.1 第 17 章その他の制御文 17.1 do-while 文 17.2 goto 文とラベル 17.3 break 文による繰返し制御 17.4 continue 文による繰返し制御 /* ex17_1_1.c */ do while (i < 10); 条件を満たさなくても 1 回は実行 i = 10; とすると違いがわかる

More information

1.1 1 C IIA $ cd comp3a %endminipage ~/comp3a mkdir $ mkdir comp3a $ cd comp3a C.c Emacs Cntrol x Control s 2 Emacs Control-x Control-f Control-

1.1 1 C IIA $ cd comp3a %endminipage ~/comp3a mkdir $ mkdir comp3a $ cd comp3a C.c Emacs Cntrol x Control s 2 Emacs Control-x Control-f Control- 1 C IIA 1 C IIA IIA 1.1 Mac OS X 1.1.1 Mac OS X Unicode(UTF-8) UTF-8 Jedit X( ) Emacs( ) Emacs Emacs Emacs [Finder] [] Emacs dock Jedit X C 1. Jedit X Dock drag & drop Jedit X [Finder] [] Jedit X Folder

More information

Java updated

Java updated Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() malloc 2 #include #include #include enum LENGTH = 10 ; int

More information

For_Beginners_CAPL.indd

For_Beginners_CAPL.indd CAPL Vector Japan Co., Ltd. 目次 1 CAPL 03 2 CAPL 03 3 CAPL 03 4 CAPL 04 4.1 CAPL 4.2 CAPL 4.3 07 5 CAPL 08 5.1 CANoe 5.2 CANalyzer 6 CAPL 10 7 CAPL 11 7.1 CAPL 7.2 CAPL 7.3 CAPL 7.4 CAPL 16 7.5 18 8 CAPL

More information

Microsoft PowerPoint - CproNt02.ppt [互換モード]

Microsoft PowerPoint - CproNt02.ppt [互換モード] 第 2 章 C プログラムの書き方 CPro:02-01 概要 C プログラムの構成要素は関数 ( プログラム = 関数の集まり ) 関数は, ヘッダと本体からなる 使用する関数は, プログラムの先頭 ( 厳密には, 使用場所より前 ) で型宣言 ( プロトタイプ宣言 ) する 関数は仮引数を用いることができる ( なくてもよい ) 関数には戻り値がある ( なくてもよい void 型 ) コメント

More information

Microsoft Word - Cプログラミング演習(8)

Microsoft Word - Cプログラミング演習(8) 第 8 回 (6/11) プログラミングスタイルなど [1] 名前のつけかた グローバル変数にはわかりやすい名前を, ローカル変数には短い名前を 関連性のあるものには関連性のある名前をつけて, 統一しよう 関数には能動的な名前を 名前は的確に 例題 1 次のコードの名前と値の選び方についてコメントせよ? #define TRUE 0? #define FALSE 1?? if ((ch = getchar())

More information

p = 1, 2, cos 2n + p)πj = cos 2nπj 2n + p)πj, sin = sin 2nπj 7.1) f j = a ) 0 + a p + a n+p cos 2nπj p=1 p=0 1 + ) b n+p p=0 sin 2nπj 1 2 a 0 +

p = 1, 2, cos 2n + p)πj = cos 2nπj 2n + p)πj, sin = sin 2nπj 7.1) f j = a ) 0 + a p + a n+p cos 2nπj p=1 p=0 1 + ) b n+p p=0 sin 2nπj 1 2 a 0 + 7 7.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave T > 0 t 44.1 khz t = 1 44100 j t f j {f 0, f 1, f 2,, f 1 = T t 7.2 T {f 0, f 1, f 2,, f 1 T ft) f j = fj t) j = 0, 1,

More information

double float

double float 2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................

More information

数値計算

数値計算 数値計算 垣谷公徳 17 号館 3 階電子メール : kimi@ee.ous.ac.jp プログラミング言語の一般論 データ型 ( 定数と変数 配列 ) 代入 基本演算 ( 四則演算 ) 入出力 分岐 繰返処理 関数 外部手続き 1 2 入力関数 入出力 getchar, getc, fgetc ; 一文字入力 gets, fgets, fread ; 文字列 ( データ列 ) 入力 scanf,

More information

6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = N t N 44.1 khz t = 1 sec j t f j {f 0, f 1, f 2,, f N 1

6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = N t N 44.1 khz t = 1 sec j t f j {f 0, f 1, f 2,, f N 1 6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = t 44.1 khz t = 1 sec 44100 j t f j {f 0, f 1, f 2,, f 1 6.2 T {f 0, f 1, f 2,, f 1 T ft) f j = fj t) j = 0, 1, 2,,

More information

プログラミング基礎

プログラミング基礎 C プログラミング 演習 アルゴリズム基礎論 演習 第 10 回 今後の予定 12/22( 月 ) 期末試験 (60 分間 ) 場所 :A1611 時間 :16:20~17:20 課題の最終提出締切 :12/19( 金 ) これ以降の新規提出は評価されない 12/22までに最終状況を提示するので, 提出したのに や になってる人は自分の提出内容や提出先を再確認した上で12/26までに問い合わせること

More information

n 第1章 章立ての部分は、書式(PC入門大見出し)を使います

n 第1章 章立ての部分は、書式(PC入門大見出し)を使います FORTRAN FORTRAN FORTRAN ) DO DO IF IF FORTRAN FORTRAN(FORmula TRANslator)1956 IBM FORTRAN IV FORTRAN77 Fortran90 FORTRAN77 FORTRAN FORTARN IF, DO C UNIX FORTRAN PASCAL COBOL PL/I BASIC Lisp PROLOG Lisp

More information

(search: ) [1] ( ) 2 (linear search) (sequential search) 1

(search: ) [1] ( ) 2 (linear search) (sequential search) 1 2005 11 14 1 1.1 2 1.2 (search:) [1] () 2 (linear search) (sequential search) 1 2.1 2.1.1 List 2-1(p.37) 1 1 13 n

More information

untitled

untitled Q 8 1 8.1 (C++) C++ cin cout 5 C++ 16 6 p.63 8.3 #include 7 showbase noshowbase showpoint noshowpoint 8.3 uppercase 16 nouppercase 16 setfill(int) setprecision(int) setw(int) setbase(int) dec

More information

第7章 有限要素法のプログラミング

第7章 有限要素法のプログラミング April 3, 2019 1 / 34 7.1 ( ) 2 Poisson 2 / 34 7.2 femfp.c [1] main( ) input( ) assem( ) ecm( ) f( ) solve( ) gs { solve( ) output( ) 3 / 34 7.3 fopen() #include FILE *fopen(char *fname, char

More information

file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose

filea fileb fp = fopen(a, r); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen(b, r); while(fgets(line, BUFSIZ, fp)) {... fclose I117 9 2 School of Information Science, Japan Advanced Institute of Science and Technology file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line,

More information

double 2 std::cin, std::cout 1.2 C fopen() fclose() C++ std::fstream 1-3 #include <fstream> std::fstream fout; int a = 123; fout.open( "data.t

double 2 std::cin, std::cout 1.2 C fopen() fclose() C++ std::fstream 1-3 #include <fstream> std::fstream fout; int a = 123; fout.open( data.t C++ 1 C C++ C++ C C C++ 1.1 C printf() scanf() C++ C 1-1 #include int a; scanf( "%d", &a ); printf( "a = %d\n", a ); C++ 1-2 int a; std::cin >> a; std::cout

More information

K227 Java 2

K227 Java 2 1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html

More information

1.3 2 gnuplot> set samples gnuplot> plot sin(x) sin gnuplot> plot [0:6.28] [-1.5:1.5] sin(x) gnuplot> plot [-6.28:6.28] [-1.5:1.5] sin(x),co

1.3 2 gnuplot> set samples gnuplot> plot sin(x) sin gnuplot> plot [0:6.28] [-1.5:1.5] sin(x) gnuplot> plot [-6.28:6.28] [-1.5:1.5] sin(x),co gnuplot 8 gnuplot 1 1.1 gnuplot gnuplot 2D 3D gnuplot ( ) gnuplot UNIX Windows Machintosh Excel gnuplot C 1.2 web gnuplot $ gnuplot gnuplot gnuplot> exit 1 1.3 2 gnuplot> set samples 1024 1024 gnuplot>

More information

新・明解Java入門

新・明解Java入門 537,... 224,... 224,... 32, 35,... 188, 216, 312 -... 38 -... 38 --... 102 --... 103 -=... 111 -classpath... 379 '... 106, 474!... 57, 97!=... 56 "... 14, 476 %... 38 %=... 111 &... 240, 247 &&... 66,

More information

解きながら学ぶJava入門編

解きながら学ぶJava入門編 44 // class Negative { System.out.print(""); int n = stdin.nextint(); if (n < 0) System.out.println(""); -10 Ÿ 35 Ÿ 0 n if statement if ( ) if i f ( ) if n < 0 < true false true false boolean literalboolean

More information

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1 I117 II I117 PROGRAMMING PRACTICE II 2 MEMORY MANAGEMENT 2 Research Center for Advanced Computing Infrastructure (RCACI) / Yasuhiro Ohara yasu@jaist.ac.jp / SCHEDULE 1. 2011/06/07(Tue) / Basic of Programming

More information

Excel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 初版 1 刷発行時のものです.

Excel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます.   このサンプルページの内容は, 初版 1 刷発行時のものです. Excel ではじめる数値解析 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/009631 このサンプルページの内容は, 初版 1 刷発行時のものです. Excel URL http://www.morikita.co.jp/books/mid/009631 i Microsoft Windows

More information

2004 2005 2 2 1G01P038-0 1 2 1.1.............................. 2 1.2......................... 2 1.3......................... 3 2 4 2.1............................ 4 2.2....................... 4 2.3.......................

More information

8 / 0 1 i++ i 1 i-- i C !!! C 2

8 / 0 1 i++ i 1 i-- i C !!! C 2 C 2006 5 2 printf() 1 [1] 5 8 C 5 ( ) 6 (auto) (static) 7 (=) 1 8 / 0 1 i++ i 1 i-- i 1 2 2.1 C 4 5 3 13!!! C 2 2.2 C ( ) 4 1 HTML はじめ mkdir work 作業用ディレクトリーの作成 emacs hoge.c& エディターによりソースプログラム作成 gcc -o fuga

More information

2008 IIA (program) pro(before)+gram(write) (artificial language) (programming languege) (programming) (machine language) (assembly language) ( )

2008 IIA (program) pro(before)+gram(write) (artificial language) (programming languege) (programming) (machine language) (assembly language) ( ) 2008 IIA 1 1.1 (program) pro(before)+gram(write) (artificial language) (programming languege) (programming) (machine language) (assembly language) () (high-level language) 3 (machine language) (CPU) 0

More information

講習No.12

講習No.12 前回までの関数のまとめ 関数は main() 関数または他の関数から呼び出されて実行される. 関数を呼び出す側の実引数の値が関数内の仮引数 ( 変数 ) にコピーされる. 関数内で定義した変数は, 関数の外からは用いることができない ( ローカル変数 ). 一般に関数内で仮引数を変化しても, 呼び出し側の変数は変化しない ( 値渡し ). 関数内で求めた値は return 文によって関数値として呼び出し側に戻される.

More information

C 言語第 3 回 2 a と b? 関係演算子 a と b の関係 関係演算子 等しい a==b 等しくない a!=b より大きい a>b 以上 a>=b より小さい a<b 以下 a<=b 状態 真偽 値 条件が満たされた場合 TRUE( 真 ) 1(0 以外 ) 条件が満たされなかった場合 F

C 言語第 3 回 2 a と b? 関係演算子 a と b の関係 関係演算子 等しい a==b 等しくない a!=b より大きい a>b 以上 a>=b より小さい a<b 以下 a<=b 状態 真偽 値 条件が満たされた場合 TRUE( 真 ) 1(0 以外 ) 条件が満たされなかった場合 F C 言語第 3 回 三つの基本構造 ( シラバス 5 6 回目 ) 1 1 順次処理上から順番に実行していく #include int main(void) { long x, y; 最初 長い整数がつかえる 負の数もか だいたい ±21 億まで OK なんだ 掛け算するぞ x = 1000*2000; scanf("%ld", &y); printf("%ld", x*y);

More information