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

Similar documents
1 4 2 EP) (EP) (EP)


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

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

kiso2-09.key

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

G1. tateyama~$ gcc -c xxxxx.c ( ) xxxxx.o tateyama~$ gcc -o xxxxx.o yyyyy.o..... zzzzz.o Makefile make Makefile : xxxxx.o yyyyy.o... zzzzz.o ; gcc -o

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

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

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

θ (t) ω cos θ(t) = ( : θ, θ. ( ) ( ) ( 5) l () θ (t) = ω sin θ(t). ω := g l.. () θ (t) θ (t)θ (t) + ω θ (t) sin θ(t) =. [ ] d dt θ (t) ω cos θ(t

XMPによる並列化実装2

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

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

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

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

Taro-再帰関数Ⅲ(公開版).jtd

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

‚æ4›ñ

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-

P06.ppt

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

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

#define N1 N+1 double x[n1] =.5, 1., 2.; double hokan[n1] = 1.65, 2.72, 7.39 ; double xx[]=.2,.4,.6,.8,1.2,1.4,1.6,1.8; double lagrng(double xx); main

c-all.dvi

Microsoft Word - no14.docx

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

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

P05.ppt

ex12.dvi

USB ID TA DUET 24:00 DUET XXX -YY.c ( ) XXX -YY.txt() XXX ID 3 YY ID 5 () #define StudentID 231

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout <<

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)* (

PowerPoint Presentation

A 30 A A ( ) 2 C C (, machine language) C (C compiler) ( ) Mac Apple Xcode Clan

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

untitled

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

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

kiso2-06.key

ex01.dvi

導入基礎演習.ppt

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

Taro-再帰関数Ⅱ(公開版).jtd

main

演習課題No12

スライド 1

: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

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

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

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

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

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 )

P02.ppt

tuat1.dvi

Cプログラミング1(再) 第2回

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

講習No.12

橡Pro PDF

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

Cプログラミング - 第8回 構造体と再帰

17 1. strucr Potter ( ) Harry Potter and the Philosopher s Stone 1997 English Title : Harry Potter and the Philosopher s Stone : : 1997 #include<stdio

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

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

ex14.dvi

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

A/B (2010/10/08) Ver kurino/2010/soft/soft.html A/B

DKA ( 1) 1 n i=1 α i c n 1 = 0 ( 1) 2 n i 1 <i 2 α i1 α i2 c n 2 = 0 ( 1) 3 n i 1 <i 2 <i 3 α i1 α i2 α i3 c n 3 = 0. ( 1) n 1 n i 1 <i 2 < <i

C C UNIX C ( ) 4 1 HTML 1

ex01.dvi

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

Informatics 2014

QR

C

r07.dvi

新版明解C言語入門編

ohp07.dvi

sim98-8.dvi

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


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

tuat2.dvi

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


P03.ppt

pptx

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A

卒 業 研 究 報 告.PDF

Informatics 2010.key

PowerPoint プレゼンテーション

Microsoft Word - no15.docx

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

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


<4D F736F F D20438CBE8CEA8D758DC03389F0939A82C282AB2E646F63>

プログラミング及び演習 第1回 講義概容・実行制御

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

(1 ) scanf(

Transcription:

[1] #include<stdio.h> 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<stdio.h> int a, b, c, d, e, f; printf("a =?\n"); 1

scanf("%d", &a); printf("b =?\n"); scanf("%d", &b); c = a + b; d = a - b; e = a * b; f = a / b; printf("%d + %d = %d\n", a, b, c); printf("%d - %d = %d\n", a, b, d); printf("%d * %d = %d\n", a, b, e); printf("%d / %d = %d\n", a, b, f); (G2) ( ) math.h. gcc -o ***** -lm *****.c 2

[3] #include <stdio.h> #include <math.h> #define PI 3.1415926 #define HALF 180.0 float degree, theta, s, c; printf("degree =?"); scanf("%f", &degree); theta = ( degree / HALF ) * PI; s = sin(theta); c = cos(theta); printf("cos %f = %f\n", degree, c); printf("sin %f = %f\n", degree, s); printf("cos %f ^2 + sin %f ^2 = %f\n", degree, degree, pow(c,2) + pow(s,2)); 3

(G3) ( ) for for(i = 1;i <= n;i++) while while( ) ( ) For while [4] #include <stdio.h> 4

int i, n, s; printf("n =?\n"); scanf("%d", &n); s = 0; for(i = 1;i <= n;i++) s = s + i; printf("sum from 1 to %d = %d\n", n, s); [5] #include <stdio.h> double aexp, term; int i, n; 5

printf("n =?\n"); scanf("%d", &n); aexp = 1; term = 1; for(i = 1;i <= n;i++) term = term / i; aexp = aexp + term; printf("approximation of exp by terms of degree <= %d = %.15f\n", n, aexp); [6] #include <stdio.h> int a, b, q, r; 6

printf("a =?"); scanf("%d", &a); printf("b =?"); scanf("%d", &b); r = a; q = 0; while(r >= b) r = r - b; q = q + 1; printf("%d / %d = %d *** %d \n", a, b, q, r); (G3) ( ) if( ) ( ) 7

[7] ) if( ) else ( ) ( ) #include <stdio.h> int a[5], temp, i, j; for(i = 0;i <= 4;i++) printf("a[%d]=?", i+1); scanf("%d", &a[i]); 8

printf("numbers you set; \n"); for(i = 0;i <= 4;i++) printf("a[%d] = %d\n", i+1, a[i]); for(i = 0;i <= 3;i++) for(j = i+1;j <= 4;j++) if(a[i] < a[j]) temp = a[j]; a[j] = a[i]; a[i] = temp; printf("arranged numbers are\n"); for(i = 0;i <= 4;i++) printf("%d \t", a[i]); printf("\n"); 9

[8] #include <stdio.h> float a[10][10], b[10][10], c[10][10]; int i, j, k, n; printf("dimension n=? (<=10)"); scanf("%d", &n); printf("input the entries of A\n"); for(i = 1;i <= n;i++) for(j = 1;j <= n;j++) printf("a[%d][%d] =?", i, j); scanf("%f", &a[i-1][j-1]); printf("matrix A = \n"); for(i = 1;i <= n;i++) for(j = 1;j <= n;j++) printf("%f \t", a[i-1][j-1]); 10

printf("\n"); printf("input the entries of B\n"); for(i = 1;i <= n;i++) for(j = 1;j <= n;j++) printf("b[%d][%d] =?", i, j); scanf("%f", &b[i-1][j-1]); printf("matrix B = \n"); for(i = 1;i <= n;i++) for(j = 1;j <= n;j++) printf("%f \t", b[i-1][j-1]); printf("\n"); for(i = 1;i <= n;i++) for(j = 1;j <= n;j++) c[i-1][j-1] = 0; for(k = 1;k <= n;k++) 11

c[i-1][j-1] = c[i-1][j-1] + a[i-1][k-1] * b[k-1][j-1]; printf("matrix C = A * B =\n"); for(i = 1;i <= n;i++) for(j = 1;j <= n;j++) printf("%f \t", c[i-1][j-1]); printf("\n"); (G4) main func( ) int func(int a, float b, char c); (G5) float *a, b; 12

a = &b b a *a b *a [9] #include <stdio.h> int how_many(void); void number_i(int m, int *b); void rearr(int m, int *b); void result_v(int m, int *b); int a[10], n; printf("how many numbers do you input? (<= 10)\n"); n = how_many(); printf("input numbers\n"); 13

number_i(n, &a[0]); rearr(n, &a[0]); printf("rearranged numbers are : \n"); result_v(n, &a[0]); int how_many(void) int k; scanf("%d", &k); return k; void number_i(int m, int *b) int i; 14

for(i = 1;i <= m;i++) printf("number - %d - =?", i); scanf("%d", b); if(i!= m) b = b + 1; void rearr(int m, int *b) int temp, i, j; for(i = 1;i <= m-1;i++) for(j = 1;j <= m-i;j++) if(*b < *(b+j)) temp = *(b+j); *(b+j) = *b; *b = temp; if(i!= m-1) b = b + 1; 15

void result_v(int m, int *b) int i; for(i = 1;i <= m;i++) printf("%d \t", *b); if(i!= m) b = b + 1; printf("\n"); 16