1 ( )

Size: px
Start display at page:

Download "1 ( )"

Transcription

1 I : :155727B : :

2 1 ( )

3 1 ( ) 1 #include <stdio.h> 2 3 int main(){ 4 {//Q1 5 puts(""); 6 puts("q1. v "); 7 8 int v; 9 10 printf("a1.&v = %08x\n",&v); 11 puts(""); 12 } {//Q2 15 puts(""); 16 puts("q2.1 m "); int m[5]; printf("a2.&m[5] = %08x\n",&m[5]); 21 printf("a2.m+5 = %08x\n",m+5); 22 puts(""); 23 } {//Q3 26 puts(""); 27 puts("q3.1 m 2 "); int m[0]; printf("a3.&m[0] = %08x\n",&m[0]); 32 printf("a3.m[0] = %08x\n",m); 33 printf("a3.m = %08x\n",m); 34 puts(""); 35 } {//Q4 38 puts(""); 39 puts("q4.2 d 3 "); 40 2

4 41 int d[0][0]; printf("a4.&d[0][0] = %08x\n",&d[0][0]); 44 printf("a4.&d[0] = %08x\n",&d[0]); 45 printf("a4.d[0] = %08x\n",d[0]); 46 printf("a4.*d = %08x\n",*d); 47 printf("a4.d = %08x\n",d); 48 puts(""); 49 } {//Q5 52 puts(""); 53 puts("q5. a "); int a=2, b=3, c=5, *p, *q; 56 p = &b; 57 q = &c; 58 a = *p + *q; 59 puts("int a=2, b=3, c=5, *p, *q;"); 60 puts("p = &b;"); 61 puts("q = &c;"); 62 puts("a = *p + *q;\n"); printf("a5.a = %d\n",a); 65 puts(""); 66 } {//Q6 69 puts(""); 70 puts("q6. a "); int a=2, *p; 73 p = &a; 74 *p = 5; 75 puts("int a=2, *p;"); 76 puts("p = &a;"); 77 puts("*p = 5;\n"); printf("a6.a = %d\n",a); 80 puts(""); 81 } {//Q7 3

5 84 puts(""); 85 puts("q7. * p * q ** q "); 86 puts(" *(100)=200 -> 100 =200"); 87 puts("*(200)=300 -> 200 =300 \n"); int *p,**q,*r; 90 int a = 200; 91 int b = 300; 92 p = &a; 93 q = &r; 94 r = &b; 95 puts("int *p, **q,*r;"); 96 puts("int a=200;"); 97 puts("int b=300;"); 98 puts("p = &a,q = &r,r = &b;"); 99 puts("(& a 100 &b 200 )\n"); 100 printf("&a = %08x\n",&a); 101 printf("&b = %08x\n",&b); 102 printf("*p = %d\n",*p); 103 printf("*q = %08x\n",*q); 104 printf("**q = %d\n",**q); printf("a7.*p=200,*q=%08x,**q=300\n",*q); 107 puts(""); 108 } {//Q8 111 puts(""); 112 puts("q8.1 m m[k] *(m+k) "); int m[5]={0,1,2,3,4}; 115 int n; 116 for(n=0;n<5;n++){ 117 printf("m[%d] = %d\n",n,m[n]); 118 printf("*(m+%d) = %d\n",n,*(m+n)); 119 } puts("a8.m[k] m k m +k m (0 ) k \ n k *(m+k) m+ k "); 122 puts(""); 123 } {//Q9 4

6 126 puts(""); 127 puts("q9. p p+2 p \n 4 "); int *p; 130 printf("p = %08x\n",p); 131 printf("p+2 = %08x\n",p+2); puts("a9.8 "); 134 puts(""); 135 } {//Q puts(""); 139 puts("q10. "); 140 puts("a.1 m * m "); 141 puts("b. p p[0] \n"); puts("a10(a). "); 144 int m[2]={0,1}; 145 printf("m[0] => %d,*m => %d\n",m[0],*m); 146 printf("m[1] => %d,*(m+1) => %d\n\n",m[1],*(m+1)); puts("a10(b). "); 149 int *n; 150 n = m; 151 printf("n[0] => %d,*n => %d\n",n[0],*n); 152 printf("n[1] => %d,*(n+1) => %d\n\n",n[1],*(n+1)); 153 puts(""); 154 } {//Q puts(""); 158 puts("q11.,*m,*(m+3),*m+3,*m+*(m+3) "); 159 puts("static int m[5] = {10,20,40,50,30}\n"); static int m[5] = {10,20,40,50,30}; 162 printf("*m = %d\n",*m); 163 printf("*(m+3) = %d\n",*(m+3)); 164 printf("*m+3 = %d\n",*m+3); 165 printf("*m+*(m+3) = %d\n\n",*m+*(m+3)); puts("a11.*m=10,*(m+3)=50,*m+3=13,*m+*(m+3)=60"); 5

7 168 puts(""); 169 } {//Q puts(""); 173 puts("q12.,*d[2],*(d[2]+2),*d[2]+2,**d,*(*d+3),\n **d+6,*(d[1]+2),**( d+2) "); 174 puts("static int d[][3] = {{1,2,3},{5,6,7},{4,6,8},{9,7,5}};\n"); static int d[][3] = {{1,2,3},{5,6,7},{4,6,8},{9,7,5}}; 177 printf("*d[2] = %d\n",*d[2]); 178 printf("*(d[2]+2) = %d\n",*(d[2]+2)); 179 printf("*d[2]+2 = %d\n",*d[2]+2); 180 printf("**d = %d\n",**d); 181 printf("*(*d+3) = %d\n",*(*d+3)); 182 printf("**d+6 = %d\n",**d+6); 183 printf("*(d[1]+2) = %d\n",*(d[1]+2)); 184 printf("**(d+2) = %d\n\n",**(d+2)); puts("a12.*d[2]=4,*(d[2]+2)=8,*d[2]+2=6,**d=1,*(*d+3)=5,**d+6=7,*(d[1]+2)=7,**(d+2)=4" ); 187 puts(""); 188 } {//Q puts(""); 192 puts("q13. p "); 193 puts("char *str = \"abcdefg\", *p"); 194 puts("p = str + 3;"); char *str = "abcdefg",*p; 197 p = str + 3; 198 printf("p = %s\n",p); printf("a13.p = defg\n"); 201 puts(""); 202 } {//Q puts(""); 206 puts("q14. p,*p,*(p+2),&(*p)=100 "); 207 puts("char *p;\np = \"abc\";\n"); 208 6

8 209 char *p; 210 p = "abc"; 211 printf("&(*p) = %08x : 100 \n",&(*p)); 212 printf("p = %08x\n",p); 213 printf("*p = %c\n",*p); 214 printf("*(p+2) = %c\n\n",*(p+2)); puts("a14.p=100,*p=a,*(p+2)=c"); 217 puts(""); 218 } {//Q puts(""); 222 puts("q15. * m * p *q "); 223 puts("static char m[] = \"abcd\";"); 224 puts("char *p, *q;"); 225 puts("p = &m[0];"); 226 puts("q = m;\n"); static char m[] = "abcd"; 229 char *p, *q; 230 p = &m[0]; 231 q = m; 232 printf("*m = %c\n",*m); 233 printf("*p = %c\n",*p); 234 printf("*q = %c\n\n",*q); puts("a15.*m=a,*p=a,*q=a"); 237 puts(""); 238 } {//Q puts(""); 242 puts("q16. * p *(m+2) *m+2 "); 243 puts("static char m[] = \"abcd\";"); 244 puts("char *p;"); 245 puts("p = &m[2];\n"); static char m[] = "abcd"; 248 char *p; 249 p = &m[2]; 250 printf("*p = %c\n",*p); 251 printf("*(m+2) = %c\n",*(m+2)); 7

9 252 printf("*m+2 = %c\n\n",*m+2); puts("a16.*p=c,*(m+2)=c,*m+2=c"); 255 puts(""); 256 } {//Q puts(""); 260 puts("q17. p "); 261 puts("char *p,q[] = \"abcd\";"); 262 puts("p = q;"); 263 puts("*(p + 1) = x ;\n"); char *p,q[] = "abcd"; //bus error ; 266 p = q; // 267 *(p + 1) = x ; 268 printf("p = %s\n\n",p); puts("a17.p = axcd"); 271 puts(""); 272 } {//Q puts(""); 276 puts("q18. x "); 277 puts("int x;"); 278 puts("char *p;"); 279 puts("p = \"abcd\";"); 280 puts("if(p == \"abcd\") x = 0;"); 281 puts("else x = 1;\n"); int x; 284 char *p; 285 p = "abcd"; 286 if(p == "abcd") x = 0; 287 else x = 1; 288 printf("x = %x\n\n",x); puts("a18.x = 0"); 291 puts(""); 292 } {//Q19 8

10 295 puts(""); 296 puts("q19. int k; "); 297 puts("char m[max], *p;"); 298 puts("for(p=m; *p; ++p)"); 299 puts("*p += 1;\n"); puts("a19. ( )"); 302 puts("int k;"); 303 puts("char m[max];"); 304 puts("for(k=0;m[k];k++){"); 305 puts("m[k] += 1;"); 306 puts("}"); puts(""); 309 } {//Q puts(""); 313 puts("q20.,*q[2],q[3][2],*(q[2]+2),*(*(q+3)+2),**(q+1) "); 314 puts("static char *q[] = {\"abcd\", \"12345\", \"ABCDEFG\", \"987\"};\n"); static char *q[] = {"abcd", "12345", "ABCDEFG", "987"}; 317 printf("*q[2] = %c\n",*q[2]); 318 printf("q[3][2] = %c\n",q[3][2]); 319 printf("*(q[2]+2) = %c\n",*(q[2]+2)); 320 printf("*(*(q+3)+2) = %c\n",*(*(q+3)+2)); 321 printf("**(q+1) = %c\n\n",**(q+1)); puts("a20.*q[2]=a q[3][2]=7 *(q[2]+2)= C *(*(q+3)+2)=7 **(q+1)=1"); 324 puts(""); 325 } 326 return(0); 327 } 9

11 Q1. v A1.&v = 5605ab60 Q2.1 m A2.&m[5] = 5605aba4 A2.m+5 = 5605aba4 Q3.1 m 2 A3.&m[0] = 5605ab5c A3.m[0] = 5605ab5c A3.m = 5605ab5c Q4.2 d 3 A4.&d[0][0] = 5605ab58 A4.&d[0] = 5605ab58 A4.d[0] = 5605ab58 A4.*d = 5605ab58 A4.d = 5605ab58 Q5. a int a=2, b=3, c=5, *p, *q; p = &b; q = &c; a = *p + *q; A5.a = 8 Q6. a int a=2, *p; p = &a; *p = 5; A6.a = 5 10

12 Q7. *p *q **q *(100)=200 -> 100 =200 *(200)=300 -> 200 =300 int *p, **q,*r; int a=200; int b=300; p = &a,q = &r,r = &b; (&a 100 &b 200 ) &a = 5605ab0c &b = 5605ab08 *p = 200 *q = 5605ab08 **q = 300 A7.*p=200,*q=5605ab08,**q=300 Q8.1 m m[k] *(m+k) m[0] = 0 *(m+0) = 0 m[1] = 1 *(m+1) = 1 m[2] = 2 *(m+2) = 2 m[3] = 3 *(m+3) = 3 m[4] = 4 *(m+4) = 4 A8.m[k] m k m+k m (0 ) k k *(m+k) m+k Q9. p p+2 p 4 p = a067c5ab p+2 = a067c5b3 A9.8 Q10. a.1 m *m 11

13 b. p p[0] A10(a). m[0] => 0,*m => 0 m[1] => 1,*(m+1) => 1 A10(b). n[0] => 0,*n => 0 n[1] => 1,*(n+1) => 1 Q11.,*m,*(m+3),*m+3,*m+*(m+3) static int m[5] = {10,20,40,50,30} *m = 10 *(m+3) = 50 *m+3 = 13 *m+*(m+3) = 60 A11.*m=10,*(m+3)=50,*m+3=13,*m+*(m+3)=60 Q12.,*d[2],*(d[2]+2),*d[2]+2,**d,*(*d+3), **d+6,*(d[1]+2),**(d+2) static int d[][3] = {{1,2,3},{5,6,7},{4,6,8},{9,7,5}}; *d[2] = 4 *(d[2]+2) = 8 *d[2]+2 = 6 **d = 1 *(*d+3) = 5 **d+6 = 7 *(d[1]+2) = 7 **(d+2) = 4 A12.*d[2]=4,*(d[2]+2)=8,*d[2]+2=6,**d=1,*(*d+3)=5,**d+6=7,*(d[1]+2)=7,**(d+2)=4 Q13. p char *str = "abcdefg", *p p = str + 3; 12

14 p = defg A13.p = defg Q14. p,*p,*(p+2),&(*p)=100 char *p; p = "abc"; &(*p) = 09ba7a4c : 100 p = 09ba7a4c *p = a *(p+2) = c A14.p=100,*p=a,*(p+2)=c Q15. *m *p *q static char m[] = "abcd"; char *p, *q; p = &m[0]; q = m; *m = a *p = a *q = a A15.*m=a,*p=a,*q=a Q16. *p *(m+2) *m+2 static char m[] = "abcd"; char *p; p = &m[2]; *p = c *(m+2) = c *m+2 = c A16.*p=c,*(m+2)=c,*m+2=c Q17. p 13

15 char *p,q[] = "abcd"; p = q; *(p + 1) = x ; p = axcd A17.p = axcd Q18. x int x; char *p; p = "abcd"; if(p == "abcd") x = 0; else x = 1; x = 0 A18.x = 0 Q19. int k; char m[max], *p; for(p=m; *p; ++p) *p += 1; A19. ( ) int k; char m[max]; for(k=0;m[k];k++){ m[k] += 1; } Q20.,*q[2],q[3][2],*(q[2]+2),*(*(q+3)+2),**(q+1) static char *q[] = {"abcd", "12345", "ABCDEFG", "987"}; *q[2] = A q[3][2] = 7 *(q[2]+2) = C *(*(q+3)+2) = 7 **(q+1) = 1 14

16 A20.*q[2]=A q[3][2]=7 *(q[2]+2)=c *(*(q+3)+2)=7 **(q+1)=1 1. Q1 v & 2. Q2,3 &m[n ] m+n 0 &m[n ] m+n 3. Q : Q4 4. Q5 p,q b,c *p *q b,c 5. Q6 a 5 2: Q6 15

17 6. Q *r segmentation fault *p a 200 *q r ( b ) 200,**q b Q8 m[k] 0 k *(m+k) m k( ) 8. Q9 int 4byte p+2 8byte char 1byte double 8byte 9. Q10 a b 10. Q11 (static) 5 *(m+3) 3 *(m+3) m[3] *m+3 *m ( m[0] ) 3 *m+*(m+3) m[0]+m[3] m[0] m[3] 11. Q12 ( 3) 3: Q Q13 str a p str+3 3 p d NULL p defg 13. Q14 p a *p a *(p+2) 2 c 16

18 14. Q15 *m m[0] *p p m[0] *q m m 3 a 15. Q16 p m[2] *(m+2) m[0+2] *m+2 *m m a ASCII 2 c 3 c 16. Q17 bus error bus error *(p+1) x Q18 if 18. Q19 p int k k 19. Q20 ( 4) 4: Q20 17

19 2 2.1 C (char char ) ( ) 1 ( ) ( ) struct ([ ]); { ; ; ; : }; 5 5: struct(structure ) struct 18

20 2.1.2 struct = { 1, 2, 3,, m} m struct [ ] = { { 1-1, 1-2, 1-3,, 1-n}, { 2-1, 2-2, 2-3,, 2-n}, : { m-1, m-2, m-3,, m-n}, } n m 5 1 // 2 struct humanspec{ 3 char name[256]; // 4 char sex[256]; // 5 int age; // 6 int height; // 7 int weight; // 8 }; 9 10 // 11 struct humanspec humanspec[200] = { 12 {,,, }, 13 {,,, }, 14 {,,, }, 19

21 15 {,,, } // 16 }; =. ;( ) = [ ]. ;( ).( ) 1 #include <stdio.h> 2 3 struct e1557xx{ 4 int number; // 5 char *name; // 6 char sex; // 7 }; 8 9 int main(){ 10 int i = 0; 11 printf(" \t \t \n"); struct e1557xx meibo[10] = { 14 {155701," ", F }, 15 {155702," ", F }, 16 {155703," ", F }, 17 {155704," ", F }, 18 {155705," ", F }, 19 {155706,"S ", F }, 20 {155707," ", F }, 21 {155708," ", F }, 22 {155709," ", F }, 23 {155710," ", M }, 24 }; for(i=0;i<10;i++){ 20

22 27 printf("%8d%17s%5c\n",meibo[i].number,meibo[i].name,meibo[i].sex); 28 } 29 return(0); 30 } F F F F F S F F F F M ( ) * struct * ; = & ;(struct * ) 21

23 1 printf & = ; & = -> ; -> ->. ( ) -> ( ) 1 #include <stdio.h> 2 3 struct e1557xx{ 4 int number; // 5 char *name; // 6 char sex; // 7 }; 8 9 int main(){ 10 int i = 0; 11 printf(" \t \t \n"); struct e1557xx meibo[10] = { 14 {155701," ", F }, 15 {155702," ", F }, 22

24 16 {155703," ", F }, 17 {155704," ", F }, 18 {155705," ", F }, 19 {155706,"S ", F }, 20 {155707," ", F }, 21 {155708," ", F }, 22 {155709," ", F }, 23 {155710," ", M }, 24 }; struct e1557xx *p; // 27 p = meibo; // p meibo for(i=0;i<10;i++){ 30 printf("%8d%17s%5c\n",(p+i)->number,(p+i)->name,(p+i)->sex); 31 } 32 return(0); 33 } F F F F F S F F F F M ( ) 23

25 2.3 ( or ); // = ( or ) // & & int int [1] C Steve Oualline,, [2] C [3] Lecture notes 24

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

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

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

76 3 B m n AB P m n AP : PB = m : n A P B P AB m : n m < n n AB Q Q m A B AQ : QB = m : n (m n) m > n m n Q AB m : n A B Q P AB Q AB 3. 3 A(1) B(3) C(

76 3 B m n AB P m n AP : PB = m : n A P B P AB m : n m < n n AB Q Q m A B AQ : QB = m : n (m n) m > n m n Q AB m : n A B Q P AB Q AB 3. 3 A(1) B(3) C( 3 3.1 3.1.1 1 1 A P a 1 a P a P P(a) a P(a) a P(a) a a 0 a = a a < 0 a = a a < b a > b A a b a B b B b a b A a 3.1 A() B(5) AB = 5 = 3 A(3) B(1) AB = 3 1 = A(a) B(b) AB AB = b a 3.1 (1) A(6) B(1) () A(

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

P06.ppt

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

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

[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

P05.ppt

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

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

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

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

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言語で学ぶアルゴリズムとデータ構造 第 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

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

A(6, 13) B(1, 1) 65 y C 2 A(2, 1) B( 3, 2) C 66 x + 2y 1 = 0 2 A(1, 1) B(3, 0) P 67 3 A(3, 3) B(1, 2) C(4, 0) (1) ABC G (2) 3 A B C P 6

A(6, 13) B(1, 1) 65 y C 2 A(2, 1) B( 3, 2) C 66 x + 2y 1 = 0 2 A(1, 1) B(3, 0) P 67 3 A(3, 3) B(1, 2) C(4, 0) (1) ABC G (2) 3 A B C P 6 1 1 1.1 64 A6, 1) B1, 1) 65 C A, 1) B, ) C 66 + 1 = 0 A1, 1) B, 0) P 67 A, ) B1, ) C4, 0) 1) ABC G ) A B C P 64 A 1, 1) B, ) AB AB = 1) + 1) A 1, 1) 1 B, ) 1 65 66 65 C0, k) 66 1 p, p) 1 1 A B AB A 67

More information

2 (1) a = ( 2, 2), b = (1, 2), c = (4, 4) c = l a + k b l, k (2) a = (3, 5) (1) (4, 4) = l( 2, 2) + k(1, 2), (4, 4) = ( 2l + k, 2l 2k) 2l + k = 4, 2l

2 (1) a = ( 2, 2), b = (1, 2), c = (4, 4) c = l a + k b l, k (2) a = (3, 5) (1) (4, 4) = l( 2, 2) + k(1, 2), (4, 4) = ( 2l + k, 2l 2k) 2l + k = 4, 2l ABCDEF a = AB, b = a b (1) AC (3) CD (2) AD (4) CE AF B C a A D b F E (1) AC = AB + BC = AB + AO = AB + ( AB + AF) = a + ( a + b) = 2 a + b (2) AD = 2 AO = 2( AB + AF) = 2( a + b) (3) CD = AF = b (4) CE

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

IMO 1 n, 21n n (x + 2x 1) + (x 2x 1) = A, x, (a) A = 2, (b) A = 1, (c) A = 2?, 3 a, b, c cos x a cos 2 x + b cos x + c = 0 cos 2x a

IMO 1 n, 21n n (x + 2x 1) + (x 2x 1) = A, x, (a) A = 2, (b) A = 1, (c) A = 2?, 3 a, b, c cos x a cos 2 x + b cos x + c = 0 cos 2x a 1 40 (1959 1999 ) (IMO) 41 (2000 ) WEB 1 1959 1 IMO 1 n, 21n + 4 13n + 3 2 (x + 2x 1) + (x 2x 1) = A, x, (a) A = 2, (b) A = 1, (c) A = 2?, 3 a, b, c cos x a cos 2 x + b cos x + c = 0 cos 2x a = 4, b =

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

kiso2-09.key

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

More information

Microsoft Word - no14.docx

Microsoft Word - no14.docx ex26.c #define MAX 20 int max(int n, int x[]); int num[max]; int i, x; printf(" "); scanf("%d", &x); if(x > MAX) printf("%d %d \n", MAX, MAX); x = MAX; for(i = 0; i < x; i++) printf("%3d : ", i + 1); scanf("%d",

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

1 1 MM nm M1234n M4 ABAB nab ABz AB nabna AB AB nabnan B ABz nab nabnan B 202A3B B na10nb66 AB61218 n AB106 2 UUA A AA AA e AB na B na nbna B ABz na B

1 1 MM nm M1234n M4 ABAB nab ABz AB nabna AB AB nabnan B ABz nab nabnan B 202A3B B na10nb66 AB61218 n AB106 2 UUA A AA AA e AB na B na nbna B ABz na B 1 2 3 4 5 6 7 8 9 10 10 1 1 MM nm M1234n M4 ABAB nab ABz AB nabna AB AB nabnan B ABz nab nabnan B 202A3B B na10nb66 AB61218 n AB106 2 UUA A AA AA e AB na B na nbna B ABz na B na nb n(a( B) n(a ( )n(b)n(a

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

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

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

Taro-リストⅠ(公開版).jtd

Taro-リストⅠ(公開版).jtd 0. 目次 1. 再帰的なデータ構造によるリストの表現 1. 1 リストの作成と表示 1. 1. 1 リストの先頭に追加する方法 1. 1. 2 リストの末尾に追加する方法 1. 1. 3 昇順を保存してリストに追加する方法 1. 2 問題 問題 1 問題 2-1 - 1. 再帰的なデータ構造によるリストの表現 リストは データの一部に次のデータの記憶場所を示す情報 ( ポインタという ) を持つ構造をいう

More information

新たな基礎年金制度の構築に向けて

新たな基礎年金制度の構築に向けて [ ] 1 1 4 60 1 ( 1 ) 1 1 1 4 1 1 1 1 1 4 1 2 1 1 1 ( ) 2 1 1 1 1 1 1 1996 1 3 4.3(2) 1997 1 65 1 1 2 1/3 ( )2/3 1 1/3 ( ) 1 1 2 3 2 4 6 2.1 1 2 1 ( ) 13 1 1 1 1 2 2 ( ) ( ) 1 ( ) 60 1 1 2.2 (1) (3) ( 9

More information

char char 1 signed char unsigned char ( ; single-quote 0x27) ASCII Japan Advanced Institute of Science and Technology

char char 1 signed char unsigned char ( ; single-quote 0x27) ASCII Japan Advanced Institute of Science and Technology I117 3 1 School of Information Science, Japan Advanced Institute of Science and Technology char char 1 signed char -128 127 unsigned char 0 255 ( ; single-quote 0x27) ASCII Japan Advanced Institute of

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

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

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

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

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

a n a n ( ) (1) a m a n = a m+n (2) (a m ) n = a mn (3) (ab) n = a n b n (4) a m a n = a m n ( m > n ) m n 4 ( ) 552

a n a n ( ) (1) a m a n = a m+n (2) (a m ) n = a mn (3) (ab) n = a n b n (4) a m a n = a m n ( m > n ) m n 4 ( ) 552 3 3.0 a n a n ( ) () a m a n = a m+n () (a m ) n = a mn (3) (ab) n = a n b n (4) a m a n = a m n ( m > n ) m n 4 ( ) 55 3. (n ) a n n a n a n 3 4 = 8 8 3 ( 3) 4 = 8 3 8 ( ) ( ) 3 = 8 8 ( ) 3 n n 4 n n

More information

O E ( ) A a A A(a) O ( ) (1) O O () 467

O E ( ) A a A A(a) O ( ) (1) O O () 467 1 1.0 16 1 ( 1 1 ) 1 466 1.1 1.1.1 4 O E ( ) A a A A(a) O ( ) (1) O O () 467 ( ) A(a) O A 0 a x ( ) A(3), B( ), C 1, D( 5) DB C A x 5 4 3 1 0 1 3 4 5 16 A(1), B( 3) A(a) B(b) d ( ) A(a) B(b) d AB d = d(a,

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

02

02 54 163116831 02 1 168 54 158 53 162 53 148 52 152 52 10,000 0 40,000 30,000 20,000 50,000 70,000 60,000 1,000 500 1,500 2,000 0 2,500 3,000 4,000 3,500 4,500 168 54 158 53 162 53 148 52 152 52 03 52148

More information

( )

( ) 5 60 2 1 54 ( ) 0.8 2 37 3 180 4 1 9 123654789 1 2 3 4 5 6 7 8 9 5 32 4 9 3 8 2 5 6 0 7 30 36 24 8 8 6 450 3 9 26 5 2 2016 2013-2015 14 10 ABC 24DEF BCADAB BEF A F E B D C 11 4 4 1 5 5 2 6 6 3 12 54 24

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

Taro-ポインタ変数Ⅰ(公開版).j

Taro-ポインタ変数Ⅰ(公開版).j 0. 目次 1. ポインタ変数と変数 2. ポインタ変数と配列 3. ポインタ変数と構造体 4. ポインタ変数と線形リスト 5. 問題 問題 1 問題 2-1 - 1. ポインタ変数と変数 ポインタ変数には 記憶領域の番地が格納されている 通常の変数にはデータが格納されている 宣言 int *a; float *b; char *c; 意味ポインタ変数 aは 整数型データが保存されている番地を格納している

More information

< F2D837C E95CF CF68A4A94C5816A2E6A>

< F2D837C E95CF CF68A4A94C5816A2E6A> 0. 目次 6. ポインタ変数と文字処理 6. 1 文字 6. 2 文字列定数 6. 3 文字列 6. 4 文字列配列 7. ポインタ変数と関数 8. 問題 7. 1 引数とポインタ変数 7. 1. 1 変数が引数の場合 7. 1. 2 ポインタ変数が引数の場合 7. 2 引数と配列 7. 3 戻り値とポインタ変数 問題 1 問題 2-1 - 6. ポインタ変数と文字処理 6. 1 文字 文字の宣言

More information

I

I I 1 1.0 ( ) ( ) 1 2 2 3 4 1.1 ( ) 1, 2, 3, 0 1 ( ) (1) 0 (2), 3, 2, 1, 0, 1, 2, 3, 0, 1, 2, 3, 2 (3) 5 N 3 ( ) ( ) 1 ( ) 2 3, 3, 2, 1, 0, 1, 2, 3, 3 Z 3 ? 374 14 26 10 ( ) ( ) + ( ) ( ) = 14, ( ) = 26,

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

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

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

140 120 100 80 60 40 20 0 115 107 102 99 95 97 95 97 98 100 64 72 37 60 50 53 50 36 32 18 H18 H19 H20 H21 H22 H23 H24 H25 H26 H27 1 100 () 80 60 40 20 0 1 19 16 10 11 6 8 9 5 10 35 76 83 73 68 46 44 H11

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

超初心者用

超初心者用 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

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

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >=

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >= II 14 2018 7 26 : : proen@mm.ics.saitama-u.ac.jp 14,, 8 2 12:00 1 O(1) n O(n) O(log n) O(1) 32 : 1G int 4 250 M 2.5 int 21 2 0 100 0 100 #include #define HASHSIZE 100 /* */ #define NOTFOUND 0

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

T T T T A 0 1 A 1 A P (A 1 ) = C 1 6 C 8C 3 = 15 8, P (A ) = C 6 C 1 8C 3 = 3 8 T 5 B P (A 1 B) = =

T T T T A 0 1 A 1 A P (A 1 ) = C 1 6 C 8C 3 = 15 8, P (A ) = C 6 C 1 8C 3 = 3 8 T 5 B P (A 1 B) = = 4 1.. 3. 4. 1. 1 3 4 5 6 1 3 4 5 6. 1 1 1 A B P (A B) = P (A) + P (B) P (C) = P (A) P (B) 3. 1 1 P (A) = 1 P (A) A A 4. A B P A (B) = n(a B) n(a) = P (A B) P (A) 50 015 016 018 1 4 5 8 8 3 T 1 3 1 T T

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

Microsoft Word - 3new.doc

Microsoft Word - 3new.doc プログラミング演習 II 講義資料 3 ポインタ I - ポインタの基礎 1 ポインタとは ポインタとはポインタは, アドレス ( データが格納されている場所 ) を扱うデータ型です つまり, アドレスを通してデータを間接的に処理します ポインタを使用する場合の, 処理の手順は以下のようになります 1 ポインタ変数を宣言する 2 ポインタ変数へアドレスを割り当てる 3 ポインタ変数を用いて処理 (

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

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

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

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

Microsoft PowerPoint - 説明2_演算と型(C_guide2)【2015新教材対応確認済み】.pptx

Microsoft PowerPoint - 説明2_演算と型(C_guide2)【2015新教材対応確認済み】.pptx 情報ネットワーク導入ユニット Ⅰ C 言語 演算と型 演算 代入 演算と型 +,-,*,/,% = C 言語では 代入 の意味 vx = a + b; //a+b の結果を vx に代入 型 : int 型 ( 整数 ) double 型 ( 実数 ) 演算での型変換 ( 整数, 実数の混在 ) キャスト演算子 型を一時的に変更 書式指定 :printf("%6d n", a); 加減, 剰余演算

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

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

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

情報処理演習 B8クラス

情報処理演習 B8クラス 予定スケジュール ( 全 15 回 ) 1 1. 終了 プログラミング言語の基礎 2. 終了 演算と型 3. 終了 プログラムの流れの分岐 (if 文,switch 文など ) 4. 終了 プログラムの流れの繰返し (do, while, for 文など ) 5. 終了 中間レポート1 6. 終了 配列 7. 終了 関数 8. 終了 文字列 ( 文字列の配列, 文字列の操作 ) 9. 終了 ポインタ

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

C のコード例 (Z80 と同機能 ) int main(void) { int i,sum=0; for (i=1; i<=10; i++) sum=sum + i; printf ("sum=%d n",sum); 2

C のコード例 (Z80 と同機能 ) int main(void) { int i,sum=0; for (i=1; i<=10; i++) sum=sum + i; printf (sum=%d n,sum); 2 アセンブラ (Z80) の例 ORG 100H LD B,10 SUB A LOOP: ADD A,B DEC B JR NZ,LOOP LD (SUM),A HALT ORG 200H SUM: DEFS 1 END 1 C のコード例 (Z80 と同機能 ) int main(void) { int i,sum=0; for (i=1; i

More information

main

main 14 1. 12 5 main 1.23 3 1.230000 3 1.860867 1 2. 1988 1925 1911 1867 void JPcalendar(int x) 1987 1 64 1 1 1 while(1) Ctrl C void JPcalendar(int x){ if (x > 1988) printf(" %d %d \n", x, x-1988); else if(x

More information

( )

( ) 18 10 01 ( ) 1 2018 4 1.1 2018............................... 4 1.2 2018......................... 5 2 2017 7 2.1 2017............................... 7 2.2 2017......................... 8 3 2016 9 3.1 2016...............................

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

C V C 6 1 6.1.............................. 1 6.......................... 3 6.3..................... 5 6.4 NULL............................. 8 6.5......................... 9 6.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

yacc.dvi

yacc.dvi 2017 c 8 Yacc Mini-C C/C++, yacc, Mini-C, run,, Mini-C 81 Yacc Yacc, 1, 2 ( ), while ::= "while" "(" ")" while yacc 1: st while : lex KW WHILE lex LPAREN expression lex RPAREN statement 2: 3: $$ = new

More information

Part y mx + n mt + n m 1 mt n + n t m 2 t + mn 0 t m 0 n 18 y n n a 7 3 ; x α α 1 7α +t t 3 4α + 3t t x α x α y mx + n

Part y mx + n mt + n m 1 mt n + n t m 2 t + mn 0 t m 0 n 18 y n n a 7 3 ; x α α 1 7α +t t 3 4α + 3t t x α x α y mx + n Part2 47 Example 161 93 1 T a a 2 M 1 a 1 T a 2 a Point 1 T L L L T T L L T L L L T T L L T detm a 1 aa 2 a 1 2 + 1 > 0 11 T T x x M λ 12 y y x y λ 2 a + 1λ + a 2 2a + 2 0 13 D D a + 1 2 4a 2 2a + 2 a

More information

取扱説明書[L-02E]

取扱説明書[L-02E] L-02E 13.6 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 a a a 35 a a a 36 37 a 38 b c 39 d 40 f ab c de g h i a b c d e f g h i j j q r s t u v k l mn op

More information

演習課題No12

演習課題No12 演習課題 No.12 ( 課題は 3 題ある ) 課題 12-1 時間内提出 従来の C 言語には複素数を直接扱うデータ型はないので (*), 構造体で複素数 ( 英語で complex) を表すことにする. 複素数を表す構造体を以下のように定義する. struct complex float r; // 実部 ( 英語で real) float i; // 虚部 ( 英語で imaginary)

More information

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

Microsoft Word - Cプログラミング演習(11) 第 11 回 (7/2) 4. いくつかのトピック (1) ビットごとの演算子 C 言語には, 次のようなビット単位で演算を行う特別な演算子が用意されている & ビットごとの AND ビットごとの OR ^ ビットごとの XOR( 排他的論理和 ) ~ 1 の補数これらの演算子は文字型と整数型で機能し, 浮動小数点数型では使用できない AND, OR, XOR は, それぞれのオペランドの対応するビットを比較して結果を返す

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 UNIX C ( ) 4 1 HTML 1

C C UNIX C ( ) 4 1 HTML 1 C 2007 4 18 C UNIX 1 2 1 1.1 C ( ) 4 1 HTML 1 はじめ mkdir work 作業用ディレクトリーの作成 emacs hoge.c& エディターによりソースプログラム作成 gcc -o fuga hoge.c コンパイルにより機械語に変換 コンパイルエラー./fuga 実行 実行時エラー 完成 1: work hooge.c fuga 1 4 4 1 1.

More information

x, y x 3 y xy 3 x 2 y + xy 2 x 3 + y 3 = x 3 y xy 3 x 2 y + xy 2 x 3 + y 3 = 15 xy (x y) (x + y) xy (x y) (x y) ( x 2 + xy + y 2) = 15 (x y)

x, y x 3 y xy 3 x 2 y + xy 2 x 3 + y 3 = x 3 y xy 3 x 2 y + xy 2 x 3 + y 3 = 15 xy (x y) (x + y) xy (x y) (x y) ( x 2 + xy + y 2) = 15 (x y) x, y x 3 y xy 3 x 2 y + xy 2 x 3 + y 3 = 15 1 1977 x 3 y xy 3 x 2 y + xy 2 x 3 + y 3 = 15 xy (x y) (x + y) xy (x y) (x y) ( x 2 + xy + y 2) = 15 (x y) ( x 2 y + xy 2 x 2 2xy y 2) = 15 (x y) (x + y) (xy

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

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

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

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

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

Taro-リストⅢ(公開版).jtd

Taro-リストⅢ(公開版).jtd リスト Ⅲ 0. 目次 2. 基本的な操作 2. 1 リストから要素の削除 2. 2 リストの複写 2. 3 リストの連結 2. 4 問題 問題 1 問題 2-1 - 2. 基本的な操作 2. 1 リストから要素の削除 まず 一般的な処理を書き つぎに 特別な処理を書く 一般的な処理は 処理 1 : リスト中に 削除するデータを見つけ 削除する場合への対応 特別な処理は 処理 2 : 先頭のデータを削除する場合への対応

More information

1990 IMO 1990/1/15 1:00-4:00 1 N N N 1, N 1 N 2, N 2 N 3 N 3 2 x x + 52 = 3 x x , A, B, C 3,, A B, C 2,,,, 7, A, B, C

1990 IMO 1990/1/15 1:00-4:00 1 N N N 1, N 1 N 2, N 2 N 3 N 3 2 x x + 52 = 3 x x , A, B, C 3,, A B, C 2,,,, 7, A, B, C 0 9 (1990 1999 ) 10 (2000 ) 1900 1994 1995 1999 2 SAT ACT 1 1990 IMO 1990/1/15 1:00-4:00 1 N 1990 9 N N 1, N 1 N 2, N 2 N 3 N 3 2 x 2 + 25x + 52 = 3 x 2 + 25x + 80 3 2, 3 0 4 A, B, C 3,, A B, C 2,,,, 7,

More information

プログラミング基礎

プログラミング基礎 C プログラミング Ⅱ 演習 2-1(a) BMI による判定 文字列, 身長 height(double 型 ), 体重 weight (double 型 ) をメンバとする構造体 Data を定義し, それぞれのメンバの値をキーボードから入力した後, BMI を計算するプログラムを作成しなさい BMI の計算は関数化すること ( ) [ ] [ ] [ ] BMI = 体重 kg 身長 m 身長

More information

Taro-2分探索木Ⅱ(公開版).jtd

Taro-2分探索木Ⅱ(公開版).jtd 2 分探索木 Ⅱ 0. 目次 5. 2 分探索木の操作 5. 1 要素の探索 5. 2 直前の要素の探索 5. 3 直後の要素の探索 5. 4 要素の削除 5. 5 問題 問題 1-1 - 5. 2 分探索木の操作 5. 1 要素の探索 要素 44 の探索 (1) 要素 と 44 を比較して 左部分木をたどる (2) 要素 33 と 44 を比較して 右部分木をたどる (3) 要素 44 を見つけた

More information

BW BW

BW BW Induced Sorting BW 11T2042B 2015 3 23 1 1 1.1................................ 1 1.2................................... 1 2 BW 1 2.1..................................... 2 2.2 BW.................................

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

(300, 150) 120 getchar() HgBox(x, y, w, h) (x, y), w, h #include <stdio.h> #include <handy.h> int main(void) { int i; double w, h; } HgO

(300, 150) 120 getchar() HgBox(x, y, w, h) (x, y), w, h #include <stdio.h> #include <handy.h> int main(void) { int i; double w, h; } HgO Handy Graphic for Handy Graphic Version 0.5 2008-06-09 1 Handy Graphic Handy Graphic C Handy Graphic Handy Graphic Mac OS X Handy Graphic HgDisplayer Handy Graphic HgDisplayer 2 Handy Graphic 1 Handy Graphic

More information

04年度LS民法Ⅰ教材改訂版.PDF

04年度LS民法Ⅰ教材改訂版.PDF ?? A AB A B C AB A B A B A B A A B A 98 A B A B A B A B B A A B AB AB A B A BB A B A B A B A B A B A AB A B B A B AB A A C AB A C A A B A B B A B A B B A B A B B A B A B A B A B A B A B A B

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裱£²²ó ¡Ý½ÉÂꣲ¤Î²òÀ⡤±é½¬£²¡Ý

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裱£²²ó  ¡Ý½ÉÂꣲ¤Î²òÀ⡤±é½¬£²¡Ý (2018) 2018 7 5 f(x) [ 1, 1] 3 3 1 3 f(x) dx c i f(x i ) 1 0 i=1 = 5 ) ( ) 3 ( 9 f + 8 5 9 f(0) + 5 3 9 f 5 1 1 + sin(x) θ ( 1 θ dx = tan 1 + sin x 2 π ) + 1 4 1 3 [a, b] f a, b double G3(double (*f)(),

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

プログラミング基礎

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

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

: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