(1 ) scanf(

Size: px
Start display at page:

Download "(1 ) scanf("

Transcription

1 I 1 C C C printf I I CPad(bcpad) I ( ) printf II II II III III

2 (1 ) scanf() IV IV ( ) if switch V V for break continue while do-while VI VI VII

3 I (Version ) 1 C C 1972 AT&T (Dennis M. Ritchie) C OS UNIX C C 1.2 L A TEX ( ) pdf C ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ( )!! 1.c.c ( ) bcpad ] 1 1

4 ( ) #include <stdio.h> int main(void) { printf("hello, C world!y=n"); return 0; ( ) 1.2. ( ]) 4D 5A FF FF ; 1 1 2, #include <stdio.h> int main(void){printf("hello CY=n");return 0; ( ) 1.3. #include <stdio.h> int main(void) { printf("hello CY=n"); return 0; 2 2

5 #include <stdio.h> int main(void){ int i,sum; sum=0; for(i=1;i<=10;i++){ sum=sum+i; printf("1 10 %d Y=n",sum); return 0; C ( ) int main ( void ) { int i,sum ; ( ) int main(void){ int i, sum; intmain(void) int main(vo id) ( ) int ( ) main ( void ) {int i,sum ; 1 1 #include<stdio.h> # 3

6 1.4.3 ( ) 1 // /* */ 1.5. ( ) #include <stdio.h> int main(void) // main(void) { printf("hello CY=n"); return 0; /* */ ( ( ) ) E2379 hello.c 5: ( ) ( main ) W8070 hello.c 7: ( main ) *** 1 errors in Compile *** (i) { ( ) ] 1 (ii) ; ] : (iii) ] (iv) { ] 1, C3( 20) 6 4

7 I 2 C 2.1 C 2.1. Hello C 1 #include <stdio.h> 2 int main(void) 3 { 4 printf("hello CY=n"); 5 return 0; 6 Hello C (1) bcpad (2) 1 #include <stdio.h> (.h) ( ) (stdio.h) 3 100% stdio.h C { (3) 2 main(void) main int void main() main(void) Standard I/O(Input/Output) 5

8 main(void) int main(int argc, char *argv]) int main() void main() (4) main() 1 (stdio.h ).) fclose, fopen, printf, scanf, getc, getchar (5) main() ( ; ) printf() () (6) 5 0 main() ( )MS Windows Linux OS OS 0 main() II 2.2. int sum(int a, int b) { return a+b; sum() 2 a=sum(10,20); z=sum(x*x,y*y); p=sum(sum(2,3),5); 6

9 2.2 printf I printf ) ( ) printf(, ); (abc,, ) Y=n %+ 10 %d #include <stdio.h> 2 int main(void){ 3 printf("hello"); 4 printf("c"); 5 return 0; 6 HelloC #include <stdio.h> 2 int main(void){ 3 printf("helloy=n"); 4 printf("c"); 5 return 0; 6 Hello C 2 3 Hello Y=n printf("helloy=nc"); 2.4 7

10 ( ) ( 4.4 ) int a, b int x( ) #include <stdio.h> 2 int main(void){ 3 int a, b; 4 int x; 5 a=5; 6 b=3; 7 x=a+b; 8 printf("a=%dy=n",a); 9 printf("b=%dy=n",b); 10 printf("a+b=%dy=n",x); 11 return 0; 12 a=5 b=3 a+b=8 a, b, x %d %d #include <stdio.h> 2 int main(void){ 3 int a, b; 4 a=5; 5 b=3; 6 printf("%d+%d=%dy=n",a,b,a+b); 7 return 0; 8 5+3=8 6 a+b a b 8

11 I 3 I 3.1 CPad(bcpad) CPad 4 CPad Borland C++ Compiler Windows GUI Cpad Borland C++Compiler bcpad bcpad (1) 1 OK] (2) D:Y=Documents and SettingsY=usersY=My documentsy=c OK] 9

12 (3) (4) (F)] (A) (5) 1]* Hello.c (6) 2 (R)] make Ctrl] +F9] (7) (6) (R)] (make )(F) Shift] +F9] 10

13 3.2 I S15M999 ( ) :S15M999 : : printf() %d Y=n % Y= ( ) % Y=% " Y=" Y= Y= Y=Y= 3.2. %, 1 Y=150 5 "20% ",? ( ) ABCDEFGHIJKLMNOPQRSTUVWXYZ ( ) 11

14 #include <stdio.h> 2 int main(void) 3 { 4 printf("hello CY=n"); 5 return 0; ( ) :S15M999 : : 1 Y=150 5 "20% ",? 1 #include <stdio.h> 2 int main(void) 3 { 4 printf("hello CY=n"); 5 return 0; ( ) (1), (2) (1) (2) ) ) / _ / ( / < L/ / 12

15 I ( ) ( ) ( ) 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 ( 31 ) for data, DATA, Data 4.1. kadai 0510kadai kadai0510 kadai-0510 FOR fime_name FileName ( ) (- ) ( ) ( ) ( ) md MaxData MinData MonthData 4.2 C auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void default goto sizeof volatile do if static while include stdio.h printf scanf 13

16 #include <stdio.h> 2 int main(void){ 3 int auto; 4 auto=5; 5 printf("auto %d Y=n",auto); 6 return 0; C dt=100; dt 100 (= ) (u, U, l, L, LL) 4.3. a 30 a=30; a=036; a=0x1e; a=30u;! LL(long long) L e E 4.4. a b a= ; a= e+02; b= ; b=1.23e-04;! c=100f c=100.0f

17 4.3.3 ( A ) A A 4.5. (1) (2) int c; c= A ; // (1) c=65; // (2) #include <stdio.h> 2 void main(void){ 3 char c; 4 int n; 5 c= A ; 6 n=5; 7 printf("%c %d %c Y=n",c,n,c+n); 8 A 5 F! C a="moji" 8 char txt10]="hello"; // txt "Hello" strcpy(txt, "Hello"); // txt "Hello" printf() Y=n Y= n ( ) Y=n ( ), Y=t ( ), Y=xhh (16 ) a=0x32 a= Y=x

18 4.7. (1) printf("abcy=tklmy=nnopy=nsy=tty=tuy=n"); printf("y=tmnoy=n"); printf("123456y=t7890y=n"); printf(" y=t890y=n"); printf(" y=t90y=n"); abc klm nop s t u mno (2) 16 printf("%dy=n", Y=x30 ); (%d) if(i<=3286){ 3286 if(i<=maxdata){ (main() ) #define MaxData 3286 ( ; ) MaxData

19 max 1 #include <stdio.h> 2 #define max 10 3 int main(void){ 4 int i, sum=0, pro=1, sum2=0; 5 6 for(i=1;i<=max;i++) 7 sum+=i; 8 9 for(i=1;i<=max;i++) 10 pro*=i; for(i=1;i<=max;i++) 13 sum2+=i*i; printf("1 %d,, Y=n",max); 16 printf("%d, %d, %dy=n",sum,pro,sum2); 17 printf(" Y=n"); 18 return 0; ,, 55, , max 10 max (max) (6,7 ) (9,10 ) (12,13 ) #define main() 17

20 #include <stdio.h> 2 #define wa(a,b) ((a)+(b)) 3 #define pri(dt) printf("%dy=n",dt) 4 5 int main(void){ 6 int c; 7 c=wa(10,20); 8 pri(c); 9 return 0; const const const int dt=100; dt 100 // 4.4 printf II 2.2 printf printf(, ); : abc, 123,,, Y=t, Y=n : %d %s %+ ] 18

21 ! %o 8 %d 10 %x 16 ( ) %X 16 ( ) %ld long 10 %f %e ( ) %E ( ) %c %s %p o d a=1;b=2;c=3; printf(" %d %d %d Y=n",a,b,c); % #include<stdio.h> void main(void){ int a=2,b=13,c=321,d=21; printf("a=%4d,y=n",a); printf("b=%4d,y=n",b); printf("c=%4d,y=n",c); printf("c=%04d,y=n",d); 19

22 a= 2, b= 13, c= 321, d=0021, %4d %04d = 4 10 %d 10 %8d %08d %-8d 8 10 %f %10.2f (, 1 ) #include<stdio.h> int main(void){ int a=20; double da= ; printf("a=%8d,y=na=%08d,y=na=%-8d,y=n",a,a,a); printf("da=%fy=n",da); printf("da=%10.4fy=n",da); printf("da=%10.4fy=n",da*(-1)); return 0; a= 20, a= , a=20, da= da= da= (a ) 8 3 (da ) ( )

23 I 5 II 5.1 II 5.1. (1) #include<stdio.h> int main(void){ int a, c; double b; a=123; b= ; c=66; printf(" Y=n",a,a,a); printf(" Y=n",b,b,b); printf("%c,%c,%cy=n", ); return 0; 123,173,7b , e+02, E+02 A,B,C (2) #include<stdio.h> int main(void){ int a; char c; c= G ; a=5; (i) (ii) c= P ; a=3; return 0; G 5 L G g P 3 S P p (i) (ii) 21

24 5.2. ( ) ( ) 3 / / / / 4 ( ) #include<stdio.h> int main(void){ int y=2017; int m1, d1, prec1; int m2, d2, prec2; int m3, d3, prec3; double high1, low1; double high2, low2; double high3, low3; m1=1; d1 = 15; prec1=0; high1=5.12; low1=-3.24; m2=8; d2 = 23; prec2=30; high2=36.33; low2=27.87; m3=9; d3 = 30; prec3=10; high3=26.00; low3=14.00; printf(" Y=n"); return 0; , / / 2017/01/ % 2017/08/ % 2017/09/ % 22

25 I C int a; double b; char c; a, b, c 6.2 C! char unsigned char (signed) int unsigned (int) short (int) unsigned short (int) long (int) unsigned long (int) float , 6 double ( ) printf("%dy=n", sizeof(char)); printf("%dy=n", sizeof(int)); C char ( )

26 6.3 int a; a 4 (a 4 ) int a; 1 4 a a 1 8 ( ) int int (4 ) unsigned int int

27 6.4 C,,,,,,, sizeof, 6.1. int a=10,b=3; printf("a+b=%dy=n",a+b); printf("a-b=%dy=n",a-b); printf("a*b=%dy=n",a*b); printf("a/b=%dy=n",a/b); printf("a%%b=%dy=n",a%b); + a+b a b - a-b a b * a*b a b / a/b a b % a%b a b a+b=13 a-b=7 a*b=30 a/b=3 a%b=1 2 & AND a&b a b OR a b a b ^ OR a^b a b >> a>>2 a 2 << a<<3 a 3 ~ ~a a 25

28 a=0,b=1 a&b=0,a b=1 a=3,b=5 a&b=1,a b=7,a^b=6 a=3, b=5 b a &b 0 1 a b a b 0 1 a b a b 0 1 a a = , a&b = b = , a b = a^b = a>>1; a<<2; a 2 a 4 a=11 a = , a>>1 = , a<<2 = = = = a=b a b a a=3 3=a (BCpad ) int idt; 2 double ddt; 3 idt=2.7182; //idt 2 4 ddt=11.5; //ddt idt=ddt; //idt 11 6 ddt=idt; //ddt idt=(int)ddt; ddt int ( ) 26

29 ++ a++ a 1 -- a-- a a a a a 1 1) a++, ++a a=a+1 2) c=a++; c=a; a++; 3) c=++a; ++a; c=a; 6.3. int a=10,b,c,d,e; b=++a; c=a++; d=--a; e=a--; printf("a=%d, b=%d, c=%d, d=%d, e=%dy=n",a,b,c,d,e); a=10, b=11, c=11, d=11, e= , -- ++, -- *, /, % +, - >>, << = 6.4. int a,b,c; b=3;c=5; a=b+++c; printf("%d,%d,%dy=n",a,b,c);,8, 4, 5 ( ) 27

30 #include<stdio.h> void main(void){ int a,b; a=10; printf("(1)=%d,(2)=%dy=n",a++,++a); printf("(3)=%dy=n",a); printf("(4)=%d,(5)=%dy=n",++a,a++); printf("(6)=%dy=n",a); a=10;b=10; printf("(7)=%d,(8)=%dy=n",a++,++b); printf("(9)=%d,(10)=%dy=n",a,b); printf("(11)=%d,(12)=%dy=n",++a,b++); printf("(13)=%d,(14)=%dy=n",a,b); (1)=11,(2)=11 (3)=12 (4)=14,(5)=12 (6)=14 (7)=10,(8)=11 (9)=11,(10)=11 (11)=12,(12)=11 (13)=12,(14)= #include<stdio.h> void main(void){ int s; double a,b; s= ; a= ; b= ; printf("(1)=%f,(2)=%fy=n",a+b,a-b); printf("(3)=%e,(4)=%ey=n",a*b,a/b); printf("(5)=%10.4f,(6)=%8.3fy=n",a*b,a/b); printf("(7)=%d,(8)=%dy=n",s,s*s*s); printf("(9)=%f,(10)=%fy=n",4/3*3.14,3.14*4/3); (1)= ,(2)= (3)= e+05,(4)= e+07 (5)= ,(6)= (7)= ,(8)= (9)= ,(10)=

31 I 7 III 7.1 III a,b a,b #include<stdio.h> void main(void){ int a,b; a=10;b=4; 2*a+b=24 a-3*b=-2 a*b/b=10 b/a*a=0 a%b%a= a1 a5 a1 a5 #include<stdio.h> void main(void){ int a1, a2, a3, a4, a5; double ave, vari; a1=4; a2=-3; a3=5; a4=12; a5=-2; 5 4, -3, 5, 12,

32 a,b a b a,b (*********** ) 2 30 *********** *********** a 3, a a a 12,321, a 2 8 a a (double ) d d d

33 I 8 C ( ) getchar(), gets(), scanf() ( ) putchar(), puts(), printf() getchar(), putchar() getchar() #include<stdio.h> 2 void main(void){ //void main return 0; 3 int ch; // char ch; 4 ch = getchar(); 5 putchar(ch); 6 putchar( Y=n ); 7 1 a a 2 putchar(ch); abc a putchar(ch); 8.2. getchar() #include<stdio.h> 2 void main(void){ 3 int ch; 4 ch = getchar(); 5 putchar(ch); 6 putchar(ch); 7 a aa 5 6 putchar(ch); 31

34 8.2 (1 ) 1 gets(), puts() char ch100]; 1 (char ) ch] ch0] ch1] ch2] ch98] ch99] 1 char ch100]="abc"; ch] a b c 0? ch0] ch1] ch2] ch3] ch4] ( ) 0 (ch3] 0 ) #include<stdio.h> 2 void main(void){ 3 char ch100]="abcdefg"; 4 5 printf("%sy=n",ch); 6 ch3]=0; 7 printf("%sy=n",ch); 8 ch3]= D ; 9 printf("%sy=n",ch); 10 abcdefg abc abcdefg 0 Y=0! ( ) 3 3 char ch100]; 4 ch100]="abcdefg"; 5 32

35 8.4. gets() #include<stdio.h> 2 int main(void){ 3 char ch100]; 4 gets(ch); 5 puts(ch); 6 puts(ch); 7 return 0; 8 abc abc abc (4 ) 5 puts(ch); 6 puts(ch);.( ) puts() puts("") %c %s 3 char ch100]="abcdefg"; 4 printf("%c Y=n",ch); // NG 5 printf("%s Y=n",ch); // OK 6 printf("%c Y=n",ch1]); // OK 7 printf("%s Y=n",ch1]); // NG %c 1 %s gets() #include<stdio.h> 2 int main(void){ 3 char ch100]; 4 gets(ch); 5 printf("%sy=n",ch); 6 printf("%cy=n",ch2]); 7 return 0; 8 abc abc c 5 printf(); 6 printf(); 33

36 8.3 scanf() scanf() %d (int ) %lf (double ) %s (char ) %s ( ) 8.6. scanf() 1 #include<stdio.h> 2 void main(void){ 3 int n; 4 double d; 5 scanf("%d",&n); // n & 6 printf("%dy=n",n); 7 scanf("%lf",&d); //scanf double %lf 8 printf("%fy=n",d); 9 32 (5 ) (7 ) scanf() 1 #include<stdio.h> 2 void main(void){ 3 char ch100]; 4 scanf("%s",ch); // & (&ch ) 5 printf("%sy=n",ch); 6 abc abc (4 ) 5 printf();! scanf() printf() scanf("n %d",&n); printf("n "); scanf("%d",&n); 34

37 scanf() ( fgets, sscanf) 8.4 scanf() scanf() #include <stdio.h> 2 int main(void){ 3 int a, b; 4 char ch; 5 printf(" a="); 6 scanf("%d",&a); 7 printf(" ="); 8 scanf("%c",&ch); 9 printf(" b="); 10 scanf("%d",&b); 11 return 0; 12 a=12345 = b= , 6, 7, 8 6 scanf() (Y=n) ch %c 1 8 scanf(" %c",&ch); scanf("%c %c %c",&a,&b,&c); 8.5 stdlib.h rand() rand() 0 RAND_MAX(32767) 35

38 8.9. (1) a 1 #include <stdio.h> 2 #include<stdlib.h> 3 int main(void){ 4 int a; 5 a=rand(); 6 return 0; 7 (2) double b; 5 b=rand()/(rand_max+1.0); (3) a=(int)(rand()/(rand_max+1.0)*6)+1; rand() srand() rand() srand() seed rand() seed seed #include <stdio.h> #include <time.h> #include <stdlib.h> #include <windows.h> //Sleep int main(void){ srand(10); printf("%d,%d,%d,%dy=n",rand(),rand(),rand(),rand()); srand(10); printf("%d,%d,%d,%dy=n",rand(),rand(),rand(),rand()); srand((unsigned)time(null)); printf("%d,%d,%d,%dy=n",rand(),rand(),rand(),rand()); Sleep(1000); // 1000 srand((unsigned)time(null)); printf("%d,%d,%d,%dy=n",rand(),rand(),rand(),rand()); return 0; 8444,10368,10345, ,10368,10345, ,19254,31547, ,9362,9631,

39 I 9 IV 9.1 IV 9.1., : s16m999 : m : y s16m999my@ous.jp 9.2. a 5 f y 5 d : 5 : y y 5 d 9.3. (double ) seed srand() ( seed 13) 10 92, 30, 41, 22, 55, 37, 10, 75, 94, gs6v7 gs6v7 7v6Sg 37

40 9.6. (8%) 10% (n) 2 n a, b a 178 b , 94, 14952, 2, a 3, a (7 9 ) a 163,545, a (x1,x2,x3)=( 12.40, 10.34, -3.00) (y1,y2,y3)=( 81.34, , 27.90) (x,y)= ( ) ( ) (n) n qwertyuiop 5 qwertyuiop 5 t 38

41 I ( ) (if for while ) ( ) a<1 b>=12 a==b a!=b < a<b a b <= a<=b a b > a>b a b >= a>=b a b == a==b a b!= a!=b a b ( ) if(a<1) for(;b>=12;) if(a==b) while(a!=b) (true) (false) 1 0 : a==10 : a 10 : a

42 #include<stdio.h> void main(){ int a; a=0; printf("%dy=n",a==5); a=5; printf("%dy=n",a==5); (a>=3 && a<10) (a!=b b>5) (!(a<=b)) && (AND) a&&b a b (OR) a b a b! (NOT )!a a // (a 3 a < 10 a ) // (a b, 5 < b ) // (a > b) 10.2 if if ( 1, 2) { if( ) ; if( ) 1 else 2 ; 1 2 if if-else 40

43 10.5. if 1 1) if(a>10) printf("a 10 Y=n"); 2) if(a>10) printf("a 10 Y=n"); else printf("a 10 Y=n"); 3) if(a>10 && a%2==0){ printf("a 10 Y=n"); printf(" a Y=n"); if 2 scanf("%d",&a); if(a) printf("a 0 Y=n"); a a 0! if ( ) if 3 a=0; if(a==1) printf("a 1 Y=n"); printf("a 0 Y=n"); a if 4 ( { ) a=0; if(a==1){ printf("a 1 Y=n"); printf("a 0 Y=n"); 2 printf! 41

44 if else else if if( A){ 1; else if( B){ 2; else if( C){ 3; else{ 4; A 1 B 2 C if 5 1) if(a>10) printf("a 10 Y=n"); else if(a%2==0) printf("a 10 Y=n"); else printf("a 10 Y=n"); 2) if(b%4==0) printf("b 4 Y=n"); else if(b%4==1) printf("b 4 1 Y=n"); else if(b%4==2) printf("b 4 2 Y=n"); else printf("b 4 3 Y=n"); if? : a?b:c a b c ( N ) (N%2 == 0)? even++ : odd++; 42

45 C a=a+3; b=b*c; += a+=b a b a (a=a+b ) -= a-=b a b a (a=a-b ) *= a*=b a b a (a=a*b ) /= a/=b a b a (a=a/b ) %= a%=b a b a (a=a%b ) >>= a>>=b a b a <<= a<<=b a b a &= a&=b a b a = a =b a b a ^= a^=b a b a = = a+=3; b*=c; #include<stdio.h> void main(){ int a=0; a+=10; printf("%dy=n",a); a++; printf("%dy=n",a); a-=3; printf("%dy=n",a); a<<=3; printf("%dy=n",a);

46 10.3 switch if 2 switch switch( A){ case 1: 1 break; case 2: 2 break; case 3: 3 break; default: n A case 1 case 2 case 3 default n A ( switch(a) switch(i+5) ) 1, 2, 3 A A 1, 2, 3 A 1, 2, 3 default! case 1, case 2, case 3, default ( : ) scanf("%d", &n); switch(n){ case 2: printf(" 2 Y=n); break; case 3: printf(" 3 Y=n); break; case 6: printf(" 6 Y=n); break; default: printf(" 2,3,6 Y=n); 44

47 double n; switch(n){ case 1.5: printf(" 1.5 Y=n); case break break case switch( A){ case 1: 1 case 2: 2 break; case 3: 3 default: 4 A case 1 case 2 case 3 default A A case scanf("%d", &n); switch(n){ case 2: case 3: case 5: case 7: printf(" 10 Y=n); break; default: printf(" 10 Y=n); n 2, 3, 5, 7 case 7: n 2, 3, 5, 7 default: 45

48 I 11 V 11.1 V (y) y ( ) (i) 4 (ii) 100 (iii) ag8hy Ag8Hy ( ) a op b op +( ), -( ), *( ), /( ), %( ) switch ] 1 (a=): 26 (+,-,*,/,%) 1 : % 1 (b=): 4 26 % 4 2 ] 1 (a=): 6 (+,-,*,/,%) 1 : $ 1 (b=): 8 46

49 I for for for( 1 ; 2 ; 3 ) ; for (1) 1 (2) 2 (4) (3) 3 (2) (4) for 1, 2, for 1) for(i=1;i<=10;i++) 2) for(i=1;i<10;j+=2) 3) for(i=1;(i<10&&j<5);i++) 4) for(;i!=0;) n ( ) ( { ) for(i=1;i<=3;i++){ printf(" Y=n"); ( { ) for(i=1;i<=3;i++) printf("%d Y=n",i);

50 ! for if 1 { pow=1; for(i=1;i<=5;i++){ pow*=2; printf("2 %d %d Y=n",i,pow); (??) pow=1; for(i=1;i<=5;i++) pow*=2; printf("2 %d %d Y=n",i,pow); ( 3) i++, ++i, i+=1, i=i+1 1 i--, i=i-1, i*=2, i/=2 1 2, 1, 2 ( 2) i<10 i<=10 i 10 i for (i 11 for ) 48

51 ) (i 100 sum 1000 for ) sum=0; for(i=1;(i<=100)&&(sum<1000);i++) sum+=i; ( for ) sum=0; for(i=1;!(sum<0);i++) sum+=i; for for ( ) for 2 ( ) 1 #include<stdio.h> 2 int main(void){ 3 int i,j; 4 printf(" Y=n"); 5 printf(" y=n"); 6 for(i=1; i<=9; i++){ 7 printf("%d ",i); 8 for(j=1;j<=9; j++) 9 printf("%2d ",i*j); 10 printf("y=n"); return 0;

52 1 for (7 12 ) i 2 for (9,10 ) j i break break for break 1 #include<stdio.h> 2 void main(void){ 3 int sum=0; 4 int n; 5 for(;;) 6 { 7 scanf(" %d",&n); 8 if (n==0)break; 9 sum+=n; printf(" %d Y=n",sum); // for 0 break if 50

53 12.3 continue break switch for continue for for continue if 1 #include<stdio.h> 2 void main(){ 3 int i; 4 for(i=1;i<=30;i++){ 5 6 if(i%2!=0 i%3!=0) continue; 7 printf("%2d 6 Y=n",i); 8 9 f1 f2 A f3 6 i 2 3 for for 3 5 continue switch continue if 13 switch(i%2){ 14 case 0: 15 printf("i "); 16 if (i%4==0) continue; 17 printf(" 4 0 "); 17 i 2, 6 ( continue break ) 12.4 while while for while( ) ; for while for ( ) while while for 2 while(i<=10){ for(;i<=10;){ 51

54 for(i=1;i<=10;i++){ ; while i=1; while(i<=10){ ; i++; while 1) while(i<=1000) 2) while(i!=0) 3) while(i>=j) 4) while(1) //break! while do-while do-while while do while( ); while do-while do-while 1! while ; g #include<stdio.h> void main(void){ int i=0; char m50]="abcdefghijk"; do { printf("%c",mi]); while(mi++]!= g ); 52

55 I 13 VI 13.1 VI , ( ) 1. a 5 f y 5 d : math : 15 "bpiw" : qwer : 12 "ciqd" :.fin ( ) , 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 53

56 : 14 2 : : ab1 Ab1 : a1fg4rkju90 A1FG4rKJU90 : , -4, 0, 3, -4, 20,-14, 15, -6, , : 500 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 54

57 I ( ) int a10]; double b10]; ] int f10]; f0]=1;f1]=1;f2]=2;f3]=3; int a10]20]; a0]0] a0]1] a0]2]... a0]19] a1]0] a1]1] a1]2]... a1]19] a9]0] a9]1] a9]2]... a9]19] a0]0],a0]1],a1]0],a1]1] det=a0]0]*a1]1]-a1]0]*a0]1]; printf(" %f Y=n", det); int data100]; int i; for(i=0;i<10;i++){ scanf(" %d",&datai]);! 2 temp=dataj]; dataj]=datai]; datai]=temp; dataj]=datai]; datai]=dataj]; 55

58 14.2 (10,11 ) 6 int d3]={1,2,3; 7 int e2]3]={{1,2,3,{4,5,6; 8 char f]={ A, B, C ; 9 char g10]="abcdef"; 10 int h3]={0,1,2,3; // 11 char i3]="abcde"; // ( ) bcpad #include<stdio.h> int main(void){ int i; int data10]={1,2,5,-3,2,6,-4,3,-6,2; for (i=0; i<10; i++){ printf("data%d] = %dy=n", i, datai]); return 0; #include<stdio.h> void main(){ int data10]={1,2,5,-3,2,6,-4,3,-6,2; int i,temp; for(i=0;i<10;i++) printf("%2d,",datai]); printf("y=n"); i=0; while(i<9){ i++; if(datai-1]<datai]){ temp=datai-1]; datai-1]=datai]; datai]=temp; i=0; for(i=0;i<10;i++) printf("%2d,",datai]); printf("y=n"); 1, 2, 5,-3, 2, 6,-4, 3,-6, 2, 6, 5, 3, 2, 2, 2, 1,-3,-4,-6, 56

59 14.3 C #include<string.h> strcpy(ss, st) strcat(ss, st) strcmp(st1, st2) strlen(st) strncpy(ss, st, n) strncat(ss, st, n) strcmp(st1, st2, n) ss st ss st st1 st2 st1 > st2 st1 < st2 st1=st2 0 ss st n ss st n st1 st2 n strcmp(ss, st) 14.7 ( ) strcpy(ss,st) strcat(ss,st) strcmp(st1,st2) strlen(st) #include<stdio.h> 2 #include<string.h> 3 void main(void){ 4 char a]="abc"; 5 char b]="def"; 6 printf(" Y="%sY=" %d Y=n", a, strlen(a)); 7 strcpy(a,b); 8 printf(" Y="%sY=" %d Y=n", a, strlen(a)); 9 strcat(a,b); 10 printf(" Y="%sY=" %d Y=n", a, strlen(a)); 11 "abc" 3 "def" 3 "defdef" 6 57

60 14.7. strcmp ( ) 1 #include<stdio.h> 2 #include<string.h> 3 int main(void){ 4 printf("1) %dy=n", strcmp("abc","abc")); 5 printf("2) %dy=n", strcmp("abc","abd")); 6 printf("3) %dy=n", strcmp("abc","aaaa")); 7 printf("4) %dy=n", strcmp("abc","ab")); 8 printf("5) %dy=n", strcmp("ab","cc")); 9 printf("6) %dy=n", strcmp("ab","ab")); 10 return 0; 11 1) 0 2) -1 3) 1 4) 67 5) -2 6) -32 ( ) A B C D E F... Z a b c d e... z ) 2 strcmp() 0 2) C D -1 4) AB C C 67 6) A a -32 strncpy(ss,st+k,n); ss st k (k + 1 ) n strncpy(ss,st+3,5); st 3 (0,1,2,3 4 ) 5 ss a] "abcdefghijklmn" strncpy(b,a+3,5); b] "defgh" 58

61 I 15 VII (.) 20 b38khur 7 GH3AGa-2435R 12.bye : 2000 : 3 : (2 10) (1) (2 10) : (2) (2 50) : : AthLb+h430gaE153g*ok-Ovm AabEgghhkLmOotv+*- 59

62 a1fg4rkju90 kju90a1fg4r (1): Uchida (2): Uchinashi Uchida Uchinashi 5 d n (1) ( ) (20 ) (1) seed srand() (2) (1) (2) (1) (2) ( ) : 3 3, 10, 5, 16, 8, 4, 2, 1,

‚æ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

‚æ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

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

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

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

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 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

卒 業 研 究 報 告.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

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

2 P.S.P.T. P.S.P.T. wiki 26

2 P.S.P.T. P.S.P.T. wiki  26 P.S.P.T. C 2011 4 10 2 P.S.P.T. P.S.P.T. wiki p.s.p.t.since1982@gmail.com http://www23.atwiki.jp/pspt 26 3 2 1 C 8 1.1 C................................................ 8 1.1.1...........................................

More information

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

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

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

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

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

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

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

[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

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225 Java Java Java Java Java 4 p35 4-2 * *** ***** *** * Unix p36 4-3 a,b,c,d 100,200,250,500 a*b = 20000 a*b+c = 20250 a*b+c*d = 145000 (a+b)*(c+d) = 225000 a+b*c+d = 50600 b/a+d/c = 4 p38 4-4 (1) mul = 1

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

: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

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

新版明解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

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます.  このサンプルページの内容は, 新装版 1 刷発行時のものです. C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/009383 このサンプルページの内容は, 新装版 1 刷発行時のものです. i 2 22 2 13 ( ) 2 (1) ANSI (2) 2 (3) Web http://www.morikita.co.jp/books/mid/009383

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

fuga scanf("%lf%*c",&fuga); 改行文字を読み捨てる 10 進数の整数 おまじない取り込んだ値を代入する変数 scanf( %d%*c,&hoge); キーボードから取り込め という命令 1: scanf 1 1: int double scanf %d %lf printf

fuga scanf(%lf%*c,&fuga); 改行文字を読み捨てる 10 進数の整数 おまじない取り込んだ値を代入する変数 scanf( %d%*c,&hoge); キーボードから取り込め という命令 1: scanf 1 1: int double scanf %d %lf printf C 2007 5 16 9 1 9 9 if else for 2 hoge scanf("%d%*c",&hoge); ( 1 ) scanf 1 %d 10 2 %*c (p.337) [Enter] &hoge hoge 1 2 10 decimal number d 1 fuga scanf("%lf%*c",&fuga); 改行文字を読み捨てる 10 進数の整数 おまじない取り込んだ値を代入する変数

More information

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

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

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

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

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó  ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡ (2018) 2018 5 24 ( ) while ( ) do while ( ); for ( ; ; ) while int i = 0; while (i < 100) { printf("i = %3d\n", i); i++; while int i = 0; i while (i < 100) { printf("i = %3d\n", i); i++; while int i =

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

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

P05.ppt

P05.ppt 2 1 list0415.c forfor #include int i, j; for (i = 1; i

More information

数値計算

数値計算 プログラム作成から実行まで 数値計算 垣谷公徳 17 号館 3 階電子メール : kimi@ee.ous.ac.jp Source program hello.c printf("hello\n"); コンパイラ Library libc.a 0011_printf000101001 1101_getc00011100011 1011_scanf1110010100 コンパイル Object module

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

プログラミング基礎

プログラミング基礎 C プログラミング Ⅰ 条件分岐 if~else if~else 文,switch 文 条件分岐 if~else if~else 文 if~else if~else 文 複数の条件で処理を分ける if~else if~else 文の書式 if( 条件式 1){ 文 1-1; 文 1-2; else if( 条件式 2){ 文 2-1; 文 2-2; else { 文 3-1; 文 3-2; 真条件式

More information

C B

C B C 095707B 2010 6 8 1 LEVE1 2 1.1 LEVEL 1.1................................................ 2 1.1.1 1................................................ 2 1.1.2 1.2..............................................

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

解きながら学ぶ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

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

Taro-プログラミングの基礎Ⅱ(公

Taro-プログラミングの基礎Ⅱ(公 0. 目次 2. プログラムの作成 2. 1 コラッツ問題 自然数 n から出発して n が偶数ならば 2 で割り n が奇数ならば 3 倍して 1 を足す操作を行う この操作を繰り返すと最後に 1 になると予想されている 問題 1 自然数 aの操作回数を求めよ 問題 2 自然数 aから bまでのなかで 最大操作回数となる自然数を求めよ 2. 2 耐久数 正整数の各桁の数字を掛け 得られた結果についても同様の操作を繰り返す

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

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

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

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

P03.ppt

P03.ppt (2) Switch case 5 1 1 2 1 list0317.c if /*/ intnum; printf(""); scanf("%d", &num); 2 if (num % 3 == 0) puts( 0"); else if (num % 3 == 1) puts(" 1"); else puts( 32"); 3 if list0318.c /*/ intnum; printf("");

More information

prog-text.dvi

prog-text.dvi (C ) 2008 1 2008.8.7 8 1 E mail : sakkun@yokohama-cu.ac.jp 3 I 13 1 17 1.1.......................... 17 1.1.1.......................... 17 1.1.2 OS................ 17 1.2..............................

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

新・明解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

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

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó  ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡ (2018) 2018 5 17 0 0 if switch if if ( ) if ( 0) if ( ) if ( 0) if ( ) (0) if ( 0) if ( ) (0) ( ) ; if else if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 (0) 2 if else

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

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

Taro-ファイル処理(公開版).jtd

Taro-ファイル処理(公開版).jtd ファイル処理 0. 目次 1. はじめに 2. ファイル内容の表示 3. ファイル内容の複写 3. 1 文字単位 3. 2 行単位 4. 書式付き入出力 5. 文字配列への入出力 6. 課題 6. 1 課題 1 ( ファイル圧縮 復元 ) - 1 - 1. はじめに ファイル処理プログラムの形は次のようになる #include main() { FILE *fp1,*fp2; ファイルポインタの宣言

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

P02.ppt

P02.ppt int If 2 1 ,,, 3 a + b ab a - b ab a * b ab a / b ab a % b ab a + b 4 2 list0201.c /, % /*/ int vx, vy; puts(""); printf("vx"); scanf("%d", &vx); printf("vy"); scanf("%d", &vy); printf("vx + vy = %d\n",

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

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

初歩のC言語ターミナル_2014_May.pages

初歩のC言語ターミナル_2014_May.pages C Mac OS X ( Vi Mi) Xcode CD >cd C:\Users\\Desktop gcc first.c C:\Users\\Desktop>gcc -o first first.c gcc first.c C:\Users\\Desktop>first Windows OS VisualStudio VisualStudio VS2012 CD C:\ >cd C:\Users\

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

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

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

Microsoft PowerPoint - program.ppt [互換モード] プログラミング演習 バージョン 1 担当教員 : 綴木馴 プログラムの決まりについて学ぶ おすすめする参考書 ザ C 戸川隼人サイエンス社 本日の予定 1. 授業の説明. 2. コンパイラーのインストール. プログラムの決まりについて学ぶ,P31 /* The most in C */ /* hello.c */ printf("hello,world n"); プログラムの決まり ( コメント )

More information

kiso2-09.key

kiso2-09.key 座席指定はありません 計算機基礎実習II 2018 のウェブページか 第9回 ら 以下の課題に自力で取り組んで下さい 計算機基礎実習II 第7回の復習課題(rev07) 第9回の基本課題(base09) 第8回試験の結果 中間試験に関するコメント コンパイルできない不完全なプログラムなど プログラミングに慣れていない あるいは複雑な問題は 要件 をバラして段階的にプログラムを作成する exam08-2.c

More information

gengo1-2

gengo1-2 変数 プログラム中で 値を格納するには変数 variable を用いる変数は 格納する値の型によって 整数型 文字型 などの型 type をもつ変数を使うには 利用に先立って変数の宣言 declaration をしなければならない 値 変数の値はコンピュータのメモリ上に格納される 具体的にメモリのどの場所に格納されるかは言語処理系が自動的に扱うので プログラマ ( 特に初級者 ) が意識する必要はない

More information

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h>

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h> 2007 12 5 1 2 2.1 ( ) 1 1: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 #define H WIN 400 // 8 #define W WIN 300 // 9

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

Microsoft PowerPoint - 説明3_if文switch文(C_guide3)【2015新教材対応確認済み】.pptx

Microsoft PowerPoint - 説明3_if文switch文(C_guide3)【2015新教材対応確認済み】.pptx 情報ネットワーク導入ユニット Ⅰ C 言語 if 文 switch 文 3 章 : プログラムの流れの分岐 if 文 if( 条件 ) 条件が成立すれば実行 if( 条件 ) ~ else 場合分け ( 成立, 不成立 ) if( 条件 A) ~ else if( 条件 B) ~ else if( 条件 C) ~ else 場合分け ( 複数の条件での場合分け ) 等価演算子 : == ( 等しい

More information

本サンプル問題の著作権は日本商工会議所に帰属します また 本サンプル問題の無断転載 無断営利利用を厳禁します 本サンプル問題の内容や解答等に関するお問 い合わせは 受け付けておりませんので ご了承ください 日商プログラミング検定 STANDARD(C 言語 ) サンプル問題 知識科目 第 1 問 (

本サンプル問題の著作権は日本商工会議所に帰属します また 本サンプル問題の無断転載 無断営利利用を厳禁します 本サンプル問題の内容や解答等に関するお問 い合わせは 受け付けておりませんので ご了承ください 日商プログラミング検定 STANDARD(C 言語 ) サンプル問題 知識科目 第 1 問 ( 本サンプル問題の著作権は日本商工会議所に帰属します また 本サンプル問題の無断転載 無断営利利用を厳禁します 本サンプル問題の内容や解答等に関するお問 い合わせは 受け付けておりませんので ご了承ください 日商プログラミング検定 STANDARD(C 言語 ) サンプル問題 知識科目 第 1 問 ( 知識 4 択 :20 問 ) 1.C 言語ソースプログラムの拡張子は何か 1 c 2 obj 3 exe

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

スライド 1

スライド 1 プログラミング 第 3 週 静岡大学工学部機械工学科知能 材料コースロボット 計測情報分野臼杵深光電 精密コース光ナノバイオ分野居波渉 講義の前に 講義資料や演習課題 LiveCampusよりダウンロード可能 成績評価期末試験および課題により行う. 評価の配分は, おおむね試験 90%, 課題 10% である. 再試験期末試験で40 点以上 60 点未満の場合, 再試験となる. 2 月 26 日 (

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

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

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

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

/* 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

Microsoft Word - no15.docx

Microsoft Word - no15.docx ex33.c /* */ #define IDLENGTH 7 /* */ #define MAX 100 /* */ /* */ struct student char idnumber[idlength + 1]; /* */ int math; /* () */ int english; /* () */ int japanese; /* () */ double average; /* */

More information

1. 入力した文字列を得る 1.1. 関数 scanf() を使う まずは関数 scanf() を使ったプログラムを作ってみましょう 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: #include<stdio.h> #define SIZE 128 main(

1. 入力した文字列を得る 1.1. 関数 scanf() を使う まずは関数 scanf() を使ったプログラムを作ってみましょう 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: #include<stdio.h> #define SIZE 128 main( 文字列処理 三池 克明 う char 型配列である文字列の操作について解説します 覚えるというよりは必要に応じて調べられるようにしておけば良いでしょ 目 次 1. 入力した文字列を得る...1 1.1. 関数 scanf() を使う...1 1.2. 関数 gets() を使う...2 2. 文字列を数値に変換...4 2.1. 関数 atoi()...4 2.2. 関数 atof()...7 3.

More information

1 1 2 2 2.1 Java......... 2 2.2................................. 3 2.3.................................. 3 3 4 3.1....................................

1 1 2 2 2.1 Java......... 2 2.2................................. 3 2.3.................................. 3 3 4 3.1.................................... 06H082 1 1 2 2 2.1 Java......... 2 2.2................................. 3 2.3.................................. 3 3 4 3.1..................................... 4 3.2 GP.....................................

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

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

Microsoft Word - Sample_CQS-Report_English_backslant.doc

Microsoft Word - Sample_CQS-Report_English_backslant.doc ***** Corporation ANSI C compiler test system System test report 2005/11/16 Japan Novel Corporation *****V43/NQP-DS-501-1 Contents Contents......2 1. Evaluated compiler......3 1.1. smp-compiler compiler...3

More information

橡Pro PDF

橡Pro PDF 1 void main( ) char c; /* int c; */ int sum=0; while ((c = getchar())!= EOF) if(isdigit(c) ) sum += (c-'0'); printf("%d\n", sum); main()int i,sum=0; for(i=0;i

More information

A/B (2018/06/08) Ver kurino/2018/soft/soft.html A/B

A/B (2018/06/08) Ver kurino/2018/soft/soft.html A/B A/B (2018/06/08) 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 6 8 A/B 1 2018 6 8 2 1 1 1.1 OHP.................................... 1 1.2

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

I J

I J I 065763J 8 7 7 31 jikken/ +----- accumulation_demupa.c +----- accumulation_rain.c +----- frequency_demupa.c +----- frequency_rain.c +----- go.sh +----- graph_maker.sh +----- mesure-ryudai/ 2007/4/1 2007/6/30

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

Microsoft PowerPoint - C言語の復習(配布用).ppt [互換モード]

Microsoft PowerPoint - C言語の復習(配布用).ppt [互換モード] if 文 (a と b の大きい方を表示 ) C 言語 Ⅰ の復習 条件判定 (if, 条件式 ) ループ (for[ 二重まで ], while, do) 配列 ( 次元 次元 ) トレース int a, b; printf( 整数 a: ); scanf( %d, &a); printf( 整数 b: ); scanf( %d, &b); //つのif 文で表現する場合間違えやすい どっちに =

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

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

Microsoft Word - Cプログラミング演習(12) 第 12 回 (7/9) 4. いくつかのトピック (5)main 関数の引数を利用したファイル処理 main 関数は, 起動する環境から引数を受け取ることができる 例えば 次に示すように,main 関数に引数を用いたプログラムを作成する 01 /* sample */ 02 /* main 関数の引数 */ 03 #include 04 05 main(int argc, char

More information

joho07-1.ppt

joho07-1.ppt 0xbffffc5c 0xbffffc60 xxxxxxxx xxxxxxxx 00001010 00000000 00000000 00000000 01100011 00000000 00000000 00000000 xxxxxxxx x y 2 func1 func2 double func1(double y) { y = y + 5.0; return y; } double func2(double*

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

HITACHI 液晶プロジェクター CP-AX3505J/CP-AW3005J 取扱説明書 -詳細版- 【技術情報編】

HITACHI 液晶プロジェクター CP-AX3505J/CP-AW3005J 取扱説明書 -詳細版- 【技術情報編】 B A C E D 1 3 5 7 9 11 13 15 17 19 2 4 6 8 10 12 14 16 18 H G I F J M N L K Y CB/PB CR/PR COMPONENT VIDEO OUT RS-232C LAN RS-232C LAN LAN BE EF 03 06 00 2A D3 01 00 00 60 00 00 BE EF 03 06 00 BA D2 01

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) double

More information

file:///D|/C言語の擬似クラス.txt

file:///D|/C言語の擬似クラス.txt 愛知障害者職業能力開発校 システム設計科 修了研究発表会報告書 題名 : C 言語の擬似クラス あらまし : C 言語でクラスを作れるという噂の真偽を確かめるために思考錯誤した まえがき : VC++ や Java その他オブジェクト指向の言語にはクラスが存在して クラスはオブジェクトの設計図である 手法 : C++ のクラスを解析して C++ のクラスを作成して C 言語に翻訳する class struct

More information

x h = (b a)/n [x i, x i+1 ] = [a+i h, a+ (i + 1) h] A(x i ) A(x i ) = h 2 {f(x i) + f(x i+1 ) = h {f(a + i h) + f(a + (i + 1) h), (2) 2 a b n A(x i )

x h = (b a)/n [x i, x i+1 ] = [a+i h, a+ (i + 1) h] A(x i ) A(x i ) = h 2 {f(x i) + f(x i+1 ) = h {f(a + i h) + f(a + (i + 1) h), (2) 2 a b n A(x i ) 1 f(x) a b f(x)dx = n A(x i ) (1) ix [a, b] n i A(x i ) x i 1 f(x) [a, b] n h = (b a)/n y h = (b-a)/n y = f (x) h h a a+h a+2h a+(n-1)h b x 1: 1 x h = (b a)/n [x i, x i+1 ] = [a+i h, a+ (i + 1) h] A(x

More information

取扱説明書 -詳細版- 液晶プロジェクター CP-AW3019WNJ

取扱説明書 -詳細版- 液晶プロジェクター CP-AW3019WNJ B A C D E F K I M L J H G N O Q P Y CB/PB CR/PR COMPONENT VIDEO OUT RS-232C LAN RS-232C LAN LAN BE EF 03 06 00 2A D3 01 00 00 60 00 00 BE EF 03 06 00 BA D2 01 00 00 60 01 00 BE EF 03 06 00 19 D3 02 00

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

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

$ ls -l $ ls -l -a $ ls -la $ ls -F $ ls <dirname> <dirname> $ cd <dirname> <dirname> $ cd $ pwd $ cat <filename> <filename> $ less <filename> <filena

$ ls -l $ ls -l -a $ ls -la $ ls -F $ ls <dirname> <dirname> $ cd <dirname> <dirname> $ cd $ pwd $ cat <filename> <filename> $ less <filename> <filena $ pwd /home1/t0/t0903 / / /home1/t0/t0903 / / /home1/t0/t0903 / /... ~ $ ls $ ls -a $ ls -l $ ls -l -a $ ls -la $ ls -F $ ls $ cd $ cd $ pwd $ cat

More information