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

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

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

P05.ppt

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

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

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

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

橡Pro PDF

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

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

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

untitled

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

‚æ4›ñ

main

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

ex01.dvi

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

PowerPoint Presentation

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

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

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

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

関数 C 言語は関数の言語 関数とは 関数の定義 : f(x) = x * x ; 使うときは : y = f(x) 戻り値 引数

gengo1-11

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

XMPによる並列化実装2

r07.dvi

講習No.12

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

ohp07.dvi


tuat1.dvi


超初心者用

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

P06.ppt

() / (front end) (back end) (phase) (pass) 1 2

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

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

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

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

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 +

joho09.ppt

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1

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

P02.ppt

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-

joho07-1.ppt

1 4 2 EP) (EP) (EP)

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

Informatics 2014

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

CプログラミングI

Taro-数値計算の基礎Ⅱ(公開版)

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

卒 業 研 究 報 告.PDF

Microsoft Word - 03

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

1.ppt

数値計算

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

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

次に示す数値の並びを昇順にソートするものとする このソートでは配列の末尾側から操作を行っていく まず 末尾の数値 9 と 8 に着目する 昇順にソートするので この値を交換すると以下の数値の並びになる 次に末尾側から 2 番目と 3 番目の 1

() () (parse tree) ( (( ) * 50) ) ( ( NUM 10 + NUM 30 ) * NUM 50 ) ( * ) ( + ) NUM 50 NUM NUM (abstract syntax tree, AST) ( (( ) * 5

gengo1-10

Informatics 2010.key

double float

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

PowerPoint プレゼンテーション

C

DVIOUT

Microsoft Word - no15.docx

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

Microsoft PowerPoint - 計算機言語 第7回.ppt

C言語7

Informatics 2015

P03.ppt

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

PowerPoint プレゼンテーション

ex01.dvi

(ver. 1.3 (2018) ) yacc 1 1 yacc yacc (Yet Another Compiler Compiler) UNIX yacc yacc y *.y yacc ) yacc *.tab.h *.tab.c C C yacc yacc UNIX yacc bison 2

( ) ( ) lex LL(1) LL(1)

untitled

x(t) + t f(t, x) = x(t) + x (t) t x t Tayler x(t + t) = x(t) + x (t) t + 1 2! x (t) t ! x (t) t 3 + (15) Eular x t Teyler 1 Eular 2 Runge-Kutta

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

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

PowerPoint プレゼンテーション

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

プログラミング方法論 II 第 14,15 回 ( 担当 : 鈴木伸夫 ) 問題 17. x 座標と y 座標をメンバに持つ構造体 Point を作成せよ 但し座標 は double 型とする typedef struct{ (a) x; (b) y; } Point; 問題 18. 問題 17 の

kiso2-06.key

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

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

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

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

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

C , C++ C C++ C++ C cpprefjp - C++ 1 C CUI 2.1 donothing.cpp 1

Transcription:

1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &val1); while (val1 < 0.0); do printf( ); scanf( %lf, &val2); while (val2 < 0.0); arith_mean = (val1 + val2) / 2.0; /* */ geo_mean = sqrt(val1 * val2); /* */ printf( %f %f \n, arith_mean, geo_mean); return 0;

: : sin(x) x main : HandyGraphic SDK software development kit

1 1 : sin

http://www.beembee.com/2010/lego-cities

sin, void double sin(double x) /* */ return double ; void void return return;

/* */ #include <stdio.h> #include <math.h> ; double getnonnegativedouble(void); int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); val1 = getnonnegativedouble(); val2 = getnonnegativedouble(); arith_mean = (val1 + val2) / 2.0; /* */ geo_mean = sqrt(val1 * val2); /* */ printf( %f %f \n, arith_mean, geo_mean); return 0; double getnonnegativedouble(void) /* */ double val; do printf( ); scanf( %lf, &val); while (val < 0.0); return val;

double getnonnegativedouble(void); getnonnegativedouble double double power(double x, int n); power double int double void swap(int x, int y); swap int int fact(int n); fact int int

/* */ #include <stdio.h> #include <math.h> double power(double x, int n); /* power */ int main(void) int n; double x; printf( x \n ); printf( x ); scanf( %lf, &x); printf( ); scanf( %d, &n); printf( %.3f %d %.3f \n, x, n, power(x, n)); return 0; double power(double x, int n) /* x n power */ int i; for (i = 1; i < n; i++) x *= x; return x;

main main main

/* #include <stdio.h> */ int main(void) int i, n; double x, y; /* x */ y = foo(x); /* y */ main x foo x double foo(double x) /* foo */ int i; double y; /* */ foo main foo return 0; return y; foo y main y

/* swap... */ #include <stdio.h> void swap(int x, int y); /* swap */ int main(void) int x, y; x = 5; y = 3; printf( swap x = %d, y = %d\n, x, y); swap(x, y); printf( swap x = %d, y = %d\n, x, y); return 0; void swap(int x, int y) /* swap */ int tmp; printf( swap x = %d, y = %d\n, x, y); tmp = y; y = x; x = tmp; printf( swap x = %d, y = %d\n, x, y); return return;

: C scanf( %d, &n); & n n

/* 1 N */ #include <stdio.h> #define N 10 int fact(int n); /* fact */ int main(void) int i; double x; printf( 1 %d \n, N); for (i = 1; i <= N; i++) printf( %3d! = %d\n, i, fact(i)); return 0; fact(3) 6.fact(3) int fact(int n) /* n fact */ if (n == 1) return 1; else return n * fact(n - 1); 3 * fact(2) 5.fact(2) 1.fact(3) 2 * fact(1) 4.fact(1) 2.fact(2) 3.fact(1) 1

printf printf scanf C #include <stdio.h> printf standard input/output stdio.h #include <math.h>

C C # include define gcc -v verbose

gcc -lm undefined reference to *** C GCC GCC gcc - lm gcc -lm undefined reference to *** *** ( ω )

/* do-while */ #include <stdio.h> #include <math.h> int void int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &val1); while (val1 < 0.0); do printf( ); scanf( %lf, &val2); while (val2 < 0.0); arith_mean = (val1 + val2) / 2.0; /* */ geo_mean = sqrt(val1 * val2); /* */ main main printf( %f %f \n, arith_mean, geo_mean); return 0;