ex12.dvi

Size: px
Start display at page:

Download "ex12.dvi"

Transcription

1 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, , 2., Shift JIS Microsoft Windows. 0x80 8. EUC-JP Unix. 0x80 8. gcc, EUC-JP,. JIS (ISO 2022-JP) 0x7F 7. ASCII 3. Unicode Unicode,,. 3 (Shift JIS,

2 2 EUC-JP, JIS),,. Unicode,. Unicode,,. Unicode UTF-8, 8 MacOS X. UTF , Unicode UCS-2, UCS-4, UTF-7, UTF-16, UTF-32., char[]=" ", EUC-JP Shift JIS, 10.., int foo(int a[]).., extern int foo(int []);.,,,., int. ex12-1.c. int *pn, *pm pn pm int., int. &,. &. *,. *. pn = &n pn n, pn n. *pn = 2, pn 2., pn n, n 2. pm = pn, pm pn., pn n, pm n, pm n.

3 3 printf %p,.,. ex12-2.c.,. int a[10], char s[11], int, char., int *pa, char *ps, int, char. ps = s ps s. ex12-1.c,,.,, s s., s[0]., ps = s ps = &s[0]. char ps ps+1., ps s[0], ps+1 s[1]. *(ps+i) s[i]. char ps, ps char s, *(ps+i) ps[i]. int pa pa+1., char,.,,., pa a[0], pa+1 a[1]. *(pa+i) a[i]., pa+1. a[i] *(a+i).. ex12-3.c, a main b. int foo_0(int a),,., main foo_0,. int foo_1(int *a),,., main foo_1,...

4 4,,. ex12-4.c, a. for(i=0;i<=len;i++) *(b+i) = *(a+i) ; len a b. Null Terminate, while((*(c+i) = *(a+i))) i += 1 ; a c. char *_strcpy(char *t, char *s), char., char a, a,,,. char *_strcpy(char *t, char *s), while((*(t+i) = *(s+i))) i += 1 ;, s t., char *strcpy(char *t, const char *s), while((*t++ = *s++)) ; s t. t++ t,, t t. char. const char *s const,,..,., char a[n], e[n] while((*e++ = *a++)) ;.. ex12-5.c, char a[] = "message" ; char *p = "message" ;.. p, for(i=0;*(p+i);i++) printf("%s\n", p+i) ; for(;*p;p++) printf("%s\n", p) ;. a, for(i=0;*(a+i);i++) printf("%s\n", a+i) ;, for(;*a;a++) printf("%s\n", a) ;

5 5 a++., a[0] = M ;,, p[0] = M ;.. char a[] = "message" ; 8 char, a 8 message. a., p char *p = "message" ;,, char p, message p., p, a., p message,, p[0] = M,. C. ex12-6.c,, swap.,. c = a ; a = b ; b = c ; a, b, c. void not_swap_char(char a, char b)., ex12-3.c,. char, char. void swap_char(char *a, char *b) int, int. void swap_int(int *a, int *b), swap_char int.

6 6 swap_char((char *)&n, (char *)&m) ;., n, m int, &n, &m, int, int.,., (char *) char.,,,.,,., swap_char int,., swap_char *a char, c = *a a. swap_int char, (Bus Error)..,.,,. ex12-7.c,,,. void swap(void *a, void *b, size_t size). void *,.,, char. ex12-8.c char *str[3], char 3. char **pstr, char. char *str[3] str[0] char, str char., char **pstr. char *str_array[] = "abc", "defg", "hijkl", char., str_array[i] i. main argv, argc.

7 7 ex12-9.c char *strchr(const char *s, int c), s c., NULL. NULL. char *, p = strchr(s, i ) p printf. p-s, p s.., p-s unsigned int unsigned long typedef size_t.. ex12-1.c /* $Id: ex12-1.c,v :01:11+09 naito Exp $ */ #include <stdio.h> int main(int argc, char **argv) int n = 1, m = 3 ; int *pn, *pm ; pn = &n ; /* printf("*pn = %d, *pm = %d, n = %d, m = %d\n", *pn, *pm, n, m) ; */ printf("*pn = %d, n = %d, m = %d\n", *pn, n, m) ; *pn = 2 ; /* n */ printf("*pn = %d, n = %d, m = %d\n", *pn, n, m) ; /* printf("*pn = %d, *pm = %d, n = %d, m = %d\n", *pn, *pm, n, m) ; */ pm = pn ; /* pm */ printf("*pn = %d, *pm = %d, n = %d, m = %d\n", *pn, *pm, n, m) ; pn = &m ; /* pn, pm */ printf("*pn = %d, *pm = %d, n = %d, m = %d\n", *pn, *pm, n, m) ; *pm = 5 ; /* n, m */ printf("*pn = %d, *pm = %d, n = %d, m = %d\n", *pn, *pm, n, m) ; printf("pn = %p\n", pn) ; printf("pm = %p\n", pm) ; printf("address of n = %p\n", &n) ; printf("address of m = %p\n", &m) ;

8 8 ex12-2.c /* $Id: ex12-2.c,v :29:32+09 naito Exp $ */ /* */ #include <stdio.h> int main(int argc, char **argv) int a[10] = 0,1,2,3,4,5,6,7,8,9 ; char s[11] = "ABCDEFGHIJ" ; int *pa ; char *ps ; int i ; ps = s ; printf("%c %c %p %p\n", *ps, s[0], ps, &s[0]) ; printf("%c %c %p %p\n", *(ps+1), s[1], ps+1, &s[1]) ; ps = s+1 ; printf("%c %c %p %p\n", *ps, s[1], ps, &s[1]) ; printf("%c %c %p %p\n", *(ps+1), s[2], ps+1, &s[2]) ; ps = &s[2] ; printf("%c %c %p %p\n", *ps, s[2], ps, &s[2]) ; printf("%c %c %p %p\n", *(ps+1), s[3], ps+1, &s[3]) ; printf("%c %c %p %p\n", s[0], *s, &s[0], s) ; printf("%c %c %p %p\n", s[2], *(s+2), &s[2], s+2) ; ps = s+1 ; printf("%s\n", ps) ; ps = s ; for(i=0;i<10;i++) printf("%d %c %c %c %p %p %p\n", i, s[i], *(ps+i), ps[i], &s[i], s+i, ps+i) ; pa = a ; printf("%d %d %p %p\n", *pa, a[0], pa, &a[0]) ; printf("%d %d %p %p\n", *(pa+1), a[1], pa+1, &a[1]) ; pa = a+1 ; printf("%d %d %p %p\n", *pa, a[1], pa, &a[1]) ; printf("%d %d %p %p\n", *(pa+1), a[2], pa+1, &a[2]) ; pa = &a[2] ; printf("%d %d %p %p\n", *pa, a[2], pa, &a[2]) ; printf("%d %d %p %p\n", *(pa+1), a[3], pa+1, &a[3]) ; printf("%d %d %p %p\n", a[0], *a, &a[0], a) ; printf("%d %d %p %p\n", a[2], *(a+2), &a[2], a+2) ; pa = a ; for(i=0;i<10;i++) printf("%d %d %d %d %p %p %p\n", i, a[i], *(pa+i), pa[i], &a[i], a+i, pa+i) ;

9 9 ex12-3.c /* $Id: ex12-3.c,v :17:10+09 naito Exp $ */ /* */ #include <stdio.h> int foo_0(int) ; int foo_1(int *) ; int a=1 ; int main(int argc, char **argv) int b=2 ; printf("(main)\taddress of a = %p\n", &a) ; foo_0(a) ; printf("%d\n", a) ; foo_1(&a) ; printf("%d\n", a) ; printf("(main)\taddress of b = %p\n", &b) ; foo_0(b) ; printf("%d\n", b) ; foo_1(&b) ; printf("%d\n", b) ; int foo_0(int a) printf("(foo_0)\taddress of a = %p\n", &a) ; a += 1 ; int foo_1(int *a) printf("(foo_1)\taddress of a = %p\n", a) ; *a += 1 ;

10 10 ex12-4.c /* $Id: ex12-4.c,v :00:35+09 naito Exp $ */ /* */ #include <stdio.h> #include <strings.h> #define N 11 char *_strcpy(char *, char *) ; char *strcpy(char *, const char *) ; int main(int argc, char **argv) char a[n] = " " ; char b[n], c[n], d[n], e[n] ; int i, len ; len = strlen(a) ; for(i=0;i<=len;i++) *(b+i) = *(a+i) ; i = 0 ; while((*(c+i) = *(a+i))) i += 1 ; _strcpy(d,a) ; strcpy(e,a) ; printf("a = %s\n", a) ; printf("b = %s\n", b) ; printf("c = %s\n", c) ; printf("d = %s\n", d) ; printf("e = %s\n", e) ; /*, */ /* while((*e++ = *a++)) ; */ char *_strcpy(char *t, char *s) int i = 0 ; while((*(t+i) = *(s+i))) i += 1 ; return t ; char *strcpy(char *t, const char *s) char *save=t ; while((*t++ = *s++)) ; return save ;

11 11 ex12-5.c /* $Id: ex12-5.c,v :34:21+09 naito Exp $ */ /* */ #include <stdio.h> int main(int argc, char **argv) char a[] = "message" ; char *p = "message" ; int i ; printf("p = %s\n", p) ; for(i=0;*(p+i);i++) printf("%s\n", p+i) ; printf("p = %s\n", p) ; for(;*p;p++) printf("%s\n", p) ; printf("a = %s\n", a) ; for(i=0;*(a+i);i++) printf("%s\n", a+i) ; /*, */ /* for(;*a;a++) printf("%s\n", a) ; */ a[0] = M ; /* */ printf("a = %s\n", a) ; /* p[0] = M ; */

12 12 ex12-6.c /* $Id: ex12-6.c,v :28:34+09 naito Exp $ */ /* */ #include <stdio.h> void swap_char(char *, char *) ; void not_swap_char(char, char) ; void swap_int(int *, int *) ; int main(int argc, char **argv) char a = a, b = b ; int n = 0x , m = 0x ; not_swap_char(a,b) ; printf("a = %c, b = %c\n", a, b) ; swap_char(&a,&b) ; printf("a = %c, b = %c\n", a, b) ; swap_int(&n, &m) ; printf("n = %08x, m = %08x\n", n, m) ; /* BUG */ swap_char((char *)&n, (char *)&m) ; printf("n = %08x, m = %08x\n", n, m) ; /* */ /* swap_int((int *)&a, (int *)&b) ; */ void swap_char(char *a, char *b) char c ; c = *a ; *a = *b ; *b = c ; return ; void not_swap_char(char a, char b) char c ; c = a ; a = b ; b = c ; return ; void swap_int(int *a, int *b) int c ; c = *a ; *a = *b ; *b = c ; return ;

13 13 ex12-7.c /* $Id: ex12-7.c,v :39:57+09 naito Exp $ */ /* swap */ #include <stdio.h> void swap(void *, void *, size_t size) ; int main(int argc, char **argv) char a = a, b = b ; int n = 0x , m = 0x ; swap(&a,&b,sizeof(char)) ; printf("a = %c, b = %c\n", a, b) ; swap(&n,&m,sizeof(int)) ; printf("n = %08x, m = %08x\n", n, m) ; void swap(void *a, void *b, size_t size) char c ; int i=0 ; while(i<size) c = *(char *)a ; *(char *)a++ = *(char *)b ; *(char *)b++ = c ; i += 1 ; return ;

14 14 ex12-8.c /* $Id: ex12-8.c,v :37:19+09 naito Exp $ */ /* */ #include <stdio.h> int main(int argc, char **argv) char **pstr ; char *str[3] ; char s0[]="string 0", s1[]="string 1", s2[]="string 2" ; char *str_array[] = "abc", "defg", "hijkl" ; int i ; str[0] = s0 ; str[1] = s1 ; str[2] = s2 ; pstr = str ; printf("%s\n", str[0]) ; printf("%s\n", str[1]) ; printf("%s\n", str[2]) ; for(i=0;i<3;i++) printf("%s\n", *(pstr+i)) ; for(i=0;i<3;i++) printf("%s\n", str_array[i]) ; for(i=0;i<argc;i++) printf("%s\n", argv[i]) ;

15 15 ex12-9.c /* $Id: ex12-9.c,v :37:43+09 naito Exp $ */ /* */ #include <stdio.h> char *strchr(const char *, int) ; int main(int argc, char **argv) char s[] = "This is a test." ; char *p ; if ((p = strchr(s, i ))!= NULL) printf("%s\n", p) ; printf("%lu\n", p-s) ; else printf("not Found\n") ; if ((p = strchr(s, x ))!= NULL) printf("%s\n", p) ; printf("%lu\n", p-s) ; else printf("not Found\n") ; char *strchr(const char *s, int c) while((*s)&&(*s++!= c)) ; if (!*s) return NULL ; return (char *)(s-1) ;

16 16,.,,,. stdio.h, ctype.h, strings.h., exercise-12-2 exercies exercise int ext_gcd(int a, int b, int *x, int *y) a, b, ax + by =gcd(a, b) x, y, xy 0,. a b. exercise-12-2 year month day hour minute second, unsigned long., hour 24.., static int normal_year[]=31,28,31,30,31,30,31,31,30,31,30,31 ; static int leap_year[] =31,29,31,30,31,30,31,31,30,31,30,31 ; int *days_of_month=normal_year ;,. exercise-12-3 unsigned long n , n, year month day hour minute second year, month, day, hour, minute, second., hour 24. exercise-12-4 unsigned long n , n,. WWW MMM DD HH:MM:SS YYY, DD. 01. HH. MM. SS. YYYY. MMM. Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec. WWW. Sun Mon Tue Wed Thr Fri Sat , 24,

17 17 static char str[25] ;., sprintf. exercise exercise strcat exercise strncat exercise strncpy exercise strcmp exercise strncmp exercise strspn exercise strcspn exercise strstr exercise strpbrk.,.. exercise char *strrstr(const char *s1, const char *s2) s1 s2., NULL.. exercise-12-7,. char *_strtok(char *t, const char *s, const char *d) s d, t,, s t., NULL. t.,,,.., strtok. (token),., (token decomposition),., This is a test., This, is, a, test.

18 18. exercise n., ,. exercise , 100.,, int., isspace, 10, + -, 10 isdigit.,,, 10., 10, atoi.,. exercise , ex , ,.,.,.., 7 20, , ,.,,,. 8.

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

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

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

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

lexex.dvi

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

More information

求人面接資料PPT

求人面接資料PPT Hair Salon TV etc. 250" 250" 200" 200" 150" 150" 100" 100" 50" 50" 0" 0" Nov)13" Dec)13" Jan)14" Feb)14" Mar)14" Apr)14" May)14" Jun)14" Jul)14" Dec)12" Jan)13" Feb)13" Mar)13" Apr)13"

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

10

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

More information

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

02: 変数と標準入出力

02: 変数と標準入出力 C プログラミング入門 基幹 7 ( 水 5) 09: ポインタ 文字列 Linux にログインし 以下の講義ページを開いておくこと http://www-it.sci.waseda.ac.jp/teachers/w 483692/CPR/ 207-06-4 関数できなかったこと 2 配列を引数として渡す, 戻り値として返す 文字列を扱う 呼び出し元の変数を直接書き換える 例 : 2 つの変数の値を入れ替える関数

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

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

[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

02: 変数と標準入出力

02: 変数と標準入出力 C プログラミング入門 基幹 2 ( 月 4) 09: ポインタ 文字列 Linux にログインし 以下の講義ページを開いておくこと http://www-it.sci.waseda.ac.jp/ teachers/w483692/cpr1/ 2014-06-09 1 関数できなかったこと 配列を引数として渡す, 戻り値として返す 文字列を扱う 呼び出し元の変数を直接書き換える 例 : 2 つの変数の値を入れ替える関数

More information

July prog11-02.c /*, */ /* $Id: prog11-02.c,v :48:07+09 naito Exp $ */ #include <stdio.h> #define N 10 int main(int argc, cha

July prog11-02.c /*, */ /* $Id: prog11-02.c,v :48:07+09 naito Exp $ */ #include <stdio.h> #define N 10 int main(int argc, cha July 05 2002 prog11-01.c /*, */ /* $Id: prog11-01.c,v 1.2 2002-07-01 21:39:41+09 naito Exp $ */ /*, *,,. *, -1, *, -2 *. */ int days(const unsigned int year, const unsigned int month, const unsigned int

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

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

02: 変数と標準入出力

02: 変数と標準入出力 C プログラミング入門 基幹 7 ( 水 5) 09: ポインタ 文字列 Linux にログインし 以下の講義ページを開いておくこと http://www-it.sci.waseda.ac.jp/ teachers/w483692/cpr1/ 2016-06-08 1 関数できなかったこと 配列を引数として渡す, 戻り値として返す 文字列を扱う 呼び出し元の変数を直接書き換える 例 : 2 つの変数の値を入れ替える関数

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

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

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

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

初めに:

初めに: 2 Copyrightc2008 JETRO. All rights reserved. FAX 03-5572-7044 ...5...6 (1)...7... 11... 11...12...14...15...15...16...17...18 (4)...21 (5)...21 (6)...23 4 Copyrightc2008 JETRO. All rights reserved. 5 Copyrightc2008

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

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

極地研 no174.indd

極地研 no174.indd C O N T E N T S 02 10 13 no.174 June.2005 TOPICS06 1 45 46 3 12 4546 47 14 10 15 15 16 NEWS no.174 june.2005 0 100 200 300 400 500 600 700 100 100 Diameter,nm 10 10 45 20042 Feb Mar Apr May Jun Jul Aug

More information

untitled

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

More information

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

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

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

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

????? 1???

????? 1??? SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON

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

untitled

untitled 2013. Apr.4 Mon Tue Wed Thu Fri Sat Sun 4/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 5/1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 TEL WEB 1 2 3 4 1 2 3! ENTER 2013. 329 2013.

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

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

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

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

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

& & a a * * ptr p int a ; int *a ; int a ; int a int *a

& & a a * * ptr p int a ; int *a ; int a ; int a int *a int a = 123; a 123 :100 a 123 int *ptr = & a; a ptr ptr a 100 a 123 200 *ptr 200 a & & a a * * ptr p --------------------------------------------------------------------------------------------- int a

More information

(2 Linux Mozilla [ ] [ ] [ ] [ ] URL 2 qkc, nkc ~/.cshrc (emacs 2 set path=($path /usr/meiji/pub/linux/bin tcsh b

(2 Linux Mozilla [ ] [ ] [ ] [ ] URL   2 qkc, nkc ~/.cshrc (emacs 2 set path=($path /usr/meiji/pub/linux/bin tcsh b II 5 (1 2005 5 26 http://www.math.meiji.ac.jp/~mk/syori2-2005/ UNIX (Linux Linux 1 : 2005 http://www.math.meiji.ac.jp/~mk/syori2-2005/jouhousyori2-2005-00/node2. html ( (Linux 1 2 ( ( http://www.meiji.ac.jp/mind/tool/internet-license/

More information

_2009MAR.ren

_2009MAR.ren ISSN 0389-5254 2009 No.2 MAR JAPAN AIRCRAFT PILOT ASSOCIATION C O N T E N T S No.313 2009 No.2 MAR é 2009 MAR 2009 MAR 2009 MAR 2009 MAR 2009 MAR 2009 MAR 2009 MAR 2009 MAR 2009 MAR 2009 MAR 2009 MAR

More information

1 ( )

1 ( ) I : :155727B : :2015 7 30 1 ( ) 2 2 18 2.1............................................ 18 2.1.1....................................... 18 2.1.2...................................... 19 2.1.3...................................

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

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

: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

本文

本文 Apr 11, 213 (3-3497-3675) miwa-y @itochu.co.jp (3-3497-6284) maruyama-yo @itochu.co.jp 1. (1) (2) (3 (4) 2. (1)3 (2) (3)J (4) (5) (6) (7) (8) (9) (1) 46 3. Summary 2 2% 2 13 13 13 J 79 46 13 46 4 34 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

ARM gcc Kunihiko IMAI 2009 1 11 ARM gcc 1 2 2 2 3 3 4 3 4.1................................. 3 4.2............................................ 4 4.3........................................

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

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

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

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

More information

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

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

More information

ポインタ変数

ポインタ変数 プログラミング及び実習 8 馬青 1 文字列処理の標準ライブラリ関数 (1/2) これらの関数を使うためには ヘッダファイル をインクルードしておく必要がある ( 変数 s:char *, 変数 t:const char *, 変数 n: int) 関数 char *strcpy(s, t) char *strncpy(s, t, n) char *strcat(s, t) char

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

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

contents

contents 3 3 4 5 6 7 7 8 8 9 9 10 10 10 11 11 12 13 13 14 14 14 14 14 14 contents 3 3 4 5 6 7 7 8 8 9 9 10 10 10 11 11 12 13 13 14 14 14 14 14 14 01 1 22 3 3 44 studies 1 2 Hiroshima Univ. ACTIVITIES campus

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

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (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

(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

Microsoft Word - 3new.doc

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

More information

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

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

More information

有明海・八代海総合調査評価委員会 委員会報告書 別添資料

有明海・八代海総合調査評価委員会 委員会報告書 別添資料 (10 6 m 3 ) 30 20 10 0 S30 S40 S50 S60 H7 260m 3 (7.7) 2,490m 3 (72.9) 500m 3 (14.7) 160m 3 (4.7) COD T-N T-P SS St.7( ) St.9( ) St.1( ) St.7( ) + St.9( ) ( ) ( ) A-2( ) B-2( ) B-3( ) COD T-N T-P SS St.1(

More information

Print

Print 2016 5.14 6.3 6.22 7.16 )22 5.14()22() ) 6.3()5() W)26 )18 6.22(W)26() 26( 7.16()18(M) 18(M 2016 V2 0 www.imageforumfestival.com 0 V7 V9 V2 0 11:00 13:45 16:30 19:00 5/14 [sat] 5/15 [sun ] 5/16 [mon

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

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

kiso2-09.key

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

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

超初心者用

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

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

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

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

02: 変数と標準入出力

02: 変数と標準入出力 C プログラミング入門 基幹 7 ( 水 5) 1 12: コマンドライン引数 Linux にログインし 以下の講義ページを開いておくこと http://www-it.sci.waseda.ac.jp/teachers/w48369 2/CPR1/ 2017-07-05 まとめ : ポインタを使った処理 2 内容呼び出し元の変数を書き換える文字列を渡す 配列を渡すファイルポインタ複数の値を返す大きな領域を確保する

More information

6-1

6-1 6-1 (data type) 6-2 6-3 ML, Haskell, Scala Lisp, Prolog (setq x 123) (+ x 456) (setq x "abc") (+ x 456) ; 6-4 ( ) subtype INDEX is INTEGER range -10..10; type DAY is (MON, TUE, WED, THU, FRI, SAT, SUN);

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² – (2018) 11 2018 12 13 2 g v dv x dt = bv x, dv y dt = g bv y (1) b v 0 θ x(t) = v 0 cos θ ( 1 e bt) (2) b y(t) = 1 ( v 0 sin θ + g ) ( 1 e bt) g b b b t (3) 11 ( ) p14 2 1 y 4 t m y > 0 y < 0 t m1 h = 0001

More information

slide5.pptx

slide5.pptx ソフトウェア工学入門 第 5 回コマンド作成 1 head コマンド作成 1 早速ですが 次のプログラムを head.c という名前で作成してください #include #include static void do_head(file *f, long nlines); int main(int argc, char *argv[]) { if (argc!=

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

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

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

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

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

13koki_koza.indd

13koki_koza.indd Tokyo University of Science Calendar 2013. 10~2014. 3 2013 6 13 20 27 7 14 21 28 1 8 15 22 29 10 Sun Mon Tue Wed Thu Fri Sat 2 9 16 23 30 3 10 17 24 31 4 11 18 25 5 12 19 26 3 10 17 24 4 11 18 25 5 12

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

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言語 実践編

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

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

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング応用 第 15 回 知的情報システム学科張 暁華 プログラミング応用 1 授業のマナー ------ 人の話を聞くときの社会常識 1. 欠席者のかわりに登録を行わない 倫理に反することをやらない あなたの信を問われている蟻の穴から堤防が決壊 2. 私語しないこと : 質問 意見は手を挙げて大きな声ではっきりと意思表示 3. 授業以外のことをしない : 携帯をカバンにいれ イヤホンを使って音楽等を聞かない授業中ゲームを遊ばない

More information

WinHPC ppt

WinHPC ppt MPI.NET C# 2 2009 1 20 MPI.NET MPI.NET C# MPI.NET C# MPI MPI.NET 1 1 MPI.NET C# Hello World MPI.NET.NET Framework.NET C# API C# Microsoft.NET java.net (Visual Basic.NET Visual C++) C# class Helloworld

More information

tuat2.dvi

tuat2.dvi ( 2 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 7 7 ( 2 ) 1 / 54 (1) (2) (?) (1) (2) 2 ( 2 ) 2 / 54 1. 30 2. 2012 6 30 25 OS ( 2 ) 3 / 54 10 20 1993 1996 2000 2003 = 30 ( 2 ) 4 / 54 1 2 2 ( 2 ) 5 /

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

0ニ0・モgqNャX1TJf・

0ニ0・モgqNャX1TJf・ 2013 Summer 2012.4.1 >>> 2013.3.31 01 Masayuki Shimada 02 6: 6: 6: 03 SUN SAT FRI THU WED TUE MON 18 17 19 20 22 23 24 21 54 58 45 58 58 54 58 55 25 12 05 54 54 58 27 58 35 54 54 54 6: 5: 04 10: 10:54

More information

実際の株価データを用いたオプション料の計算

実際の株価データを用いたオプション料の計算 2002 2 20 1 1 3 2 3 2.1 : : : : : : : : : : : : : : : : : : : : : : : : : : : : 5 2.1.1 : : : : : : : : : : : : : : : : : : : : 5 2.1.2 : : : : : : : : : : : : : : : : : : : : 6 2.2 : : : : : : : : : :

More information

Step1 Step2 Step3 Step4 Step5 COLUMN.1 Step1 Step2 Step3 Step4 Step5 Step6 Step7 Step8 COLUMN.2 Step1 Step2 Step3 Step4 Step5 COLUMN.3 Step1 Step2 Ste

Step1 Step2 Step3 Step4 Step5 COLUMN.1 Step1 Step2 Step3 Step4 Step5 Step6 Step7 Step8 COLUMN.2 Step1 Step2 Step3 Step4 Step5 COLUMN.3 Step1 Step2 Ste 2 0 1 2 C A L E N D A R 7 8 9 SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT SUN MON TUE WED THU FRI SAT 1 2 3 4 5 6 7 1 2 3 4 8 9 10 11 12 13 14 5 6 7 8 9 10 11 15 16 17 18 19 20 21 12 13 14

More information

XMPによる並列化実装2

XMPによる並列化実装2 2 3 C Fortran Exercise 1 Exercise 2 Serial init.c init.f90 XMP xmp_init.c xmp_init.f90 Serial laplace.c laplace.f90 XMP xmp_laplace.c xmp_laplace.f90 #include int a[10]; program init integer

More information