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

Similar documents
Microsoft Word - no15.docx

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

Microsoft Word - no13.docx

P02.ppt

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

main

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

新版明解C言語入門編

DVIOUT

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

PowerPoint Presentation

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


新版明解C言語 実践編

r08.dvi

06佐々木雅哉_4C.indd

‚æ4›ñ

ohp08.dvi

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D

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

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


VISPO /表1-4

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

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

Microsoft Word - no14.docx

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

ohp07.dvi


演習課題No12

2004

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

(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

C 言語第 7 回 掛け算 (multiply number) ìz1 = x1 + iy1 í îz = x + iy 割り算 (devide number) ( )( ) ( ) Þ z z = x + iy x + iy = x x - y y + i y x + x y

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

演算増幅器

n S (n) = n S (n) S (n) S 0 (n) S (n) 6 4 S (n) S (n) 7 S (n) S 4 (n) 8 6 S k (n) 0 7 (k + )S k (n) 8 S 6 (n), S 7 (n), S 8 (n), S 9 (

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

1) OOP 2) ( ) 3.2) printf Number3-2.cpp #include <stdio.h> class Number Number(); // ~Number(); // void setnumber(float n); float getnumber();

Microsoft Word - no206.docx

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

橡Pro PDF

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-

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

Microsoft PowerPoint - kougi9.ppt

P06.ppt

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

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

Microsoft Word - no15.docx

C C UNIX C ( ) 4 1 HTML 1

gengo1-11

2 [1] 7 5 C 2.1 (kikuchi-fem-mac ) input.dat (cat input.dat type input.dat ))

1 4 2 EP) (EP) (EP)

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

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

Microsoft Word - no11.docx

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

kiso2-09.key

201908計算

C B

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

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

untitled

r03.dvi

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

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

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

ohp03.dvi

pptx

program.dvi

プログラミング基礎

ex12.dvi

数値計算

C言語10

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

C言語講座

gengo1-10

untitled

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

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

DVIOUT

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

Microsoft Word - no12.doc

配列, 関数, 構造体

Microsoft PowerPoint - kougi8.ppt

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

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

Microsoft PowerPoint - kougi11.ppt

問 2 ( 型変換 ) 次のプログラムを実行しても正しい結果が得られない 何が間違いかを指摘し 正しく修正せよ ただし int サイズが 2 バイト long サイズが 4 バイトの処理系での演算を仮定する #include <stdio.h> int main( void ) { int a =

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


プログラミング基礎

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

Microsoft PowerPoint - kougi10.ppt


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

DA13

Prog1_15th

Transcription:

17 1. strucr Potter ( ) Harry Potter and the Philosopher s Stone 1997 English Title : Harry Potter and the Philosopher s Stone : : 1997 #include<stdio.h> typedef struct Potter{ Potter; int main(void){ Potter potter1; printf("\n"); printf("\n"); printf("\n"); printf("english Title : %s\n", potter1.title); printf(" : %s\n", potter1.jptitle); printf(" : %d\n", potter1.year); return 0; 1

2. 1. 3 Harry Potter and the Philosopher s Stone 1997 Harry Potter and the Chamber of Secrets 1998 Harry Potter and the Prisoner of Azkaban 1999 English Title : Harry Potter and the Philosopher s Stone : : 1997 English Title : Harry Potter and the Chamber of Secrets : : 1998 English Title : Harry Potter and the Prisoner of Azkaban : : 1999 2

#include<stdio.h> typedef struct Potter{ Potter; int main(void){ for(i=0; i<3; i++){ printf("\n"); printf("\n"); printf("\n"); getchar(); // for(i=0 ; i<3 ; i++){ return 0; 3

3. (complex number) z = x + iy x y i i 2 = 1 z 1 = x 1 + iy 1 z 2 = x 2 + iy 2 (addition) z 1 + z 2 = z 3 z 3 = (x 1 + x 2 ) + i(y 1 + y 2 ) struct Cnum struct addcnums 2 1 cn1 2.7 5.1 cn2 3.6 8.9 cn1 = 2.7+5.1i cn2 = 3.6+8.9i cn1 + cn2 = 6.3+14.00i 2 cn1 8.2-4.3 cn2-5.4 1.9 cn1 = 8.2-4.3i cn2 = -5.4+1.9i cn1+cn2 = 2.8-2.4i 4. 3. cn1 3.5-9.4 cn2-5.6-7.1 cn1 = 3.5-9.4i cn2 = -5.6-7.1i cn1+cn2 = -2.1-16.5i 4

5. (complex number) z 1 = x 1 + iy 1 z 2 = x 2 + iy 2 (multiplication)z 1 z 2 = z 3 z 3 = (x 1 x 2 y 1 y 2 ) + i(x 1 y 2 + x 2 y 1 ) struct Cnum struct multcnums 2 1 cn1-0.5 0.86603 cn2-0.5 0.86602 cn1 = -0.50000+0.86603i cn2 = -0.50000+0.86602i cn1*cn2 = -0.50000-0.86603i 2 cn1 1 1 cn2 3-3 cn1 = 1.00000+1.00000i cn2 = 3.00000-3.00000i cn1*cn2 = 6.00000+0.00000i 6. 5. cn1 3.3 7.5 cn2-4.1 6.8 cn1 = 3.30000+7.50000i cn2 = -4.10000+6.80000i cn1*cn2 = -64.53000-8.31000i 5

7. 3 3 v1 = (v1.x, v1.y, v1.z) v2 = (v2.x, v2.y, v2.z) ( dot product) v1 v2 = v1.x v2.x + v1.y v2.y + v1.z v2.z 3 3 stuct Vector dotprod(vector v1, Vector v2) 2 1 2 7 4 2 5 1 3 vc1=(2, 7, 4) vc2=(5, 1, 3) vc1 vc2 =29 8. 7. 1 7 2 4 2 3 9 6 vc1=(7, 2, 4) vc2=(3, 9, 6) vc1 vc2 = 63 6

9. 3 v1 = (v1.x, v1.y, v1.z) v2 = (v2.x, v2.y, v2.z) ( cross product) v1 v2 = (v1.y v2.z v1.z v2.y, v1.z v2.x v1.x v2.z, v1.x v2.y v1.y v2.x) 3 3 3 stuct Vector crossprod(vector v1, Vector v1) 2 1 3 4 5 2 9 6 1 vc1=(3, 4, 5) vc2=(9, 6, 1) vc1 vc2 = (-26, 42, -18) 10. 9. 1 1 2 3 2 3 2 1 vc1=(1, 2, 3) vc2=(3, 2, 1) vc1 vc2 = (-4, 8, -4) 7

11. 3 3 stuct Vector absvalue(vector vc1) 3 (1) v = (v x, v y, v z ) v v = v 2 x + v 2 y + v 2 z (2) math.h 3 4 12 vc1=(3.000000, 4.000000, 12.000000) vc1 = 13.000000 0.5 1.2 8.4 vc1=(0.500000, 1.200000, 8.400000) vc1 = 8.500000 12. 11. 3.4 5.6 7.9 vc1=(3.400000, 5.600000, 7.900000) vc1 = 10.263040 0.8 1.5 14.4 vc1=(0.800000, 1.500000, 14.400000) vc1 = 14.500000 8

13. struct Frac addfrac(frac f1, Frac f2) 1 1/6 2 10/3 1/6+10/3=7/2 1 2/3 2 7/3 2/3+7/3=3 #include<stdio.h> typedef struct Frac{ int n; // n numerator( ) n int d; // d denominator( ) d Frac; int gcd(int n, int r){ /* */ struct Frac addfrac(frac f1, Frac f2){ /* */ int main(void){ Frac f1, f2, f3; char ch; printf(" 1 "); scanf("%d%c%d", &f1.n, &ch, &f1.d); printf(" 2 "); scanf("%d%c%d", &f2.n, &ch, &f2.d); /* */ return 0; 9

14. 13. 1 2/5 2 8/5 2/5+8/5=2 1 1/4 2 1/6 1/4+1/6=5/12 #include<stdio.h> typedef struct Frac{ int n; // n numerator( ) n int d; // d denominator( ) d Frac; int gcd(int n, int r){ /* */ void addfrac(frac *f1, Frac *f2, Frac *f3){ /* */ int main(void){ Frac f1, f2, f3; char ch; printf(" 1 "); scanf("%d%c%d", &f1.n, &ch, &f1.d); printf(" 2 "); scanf("%d%c%d", &f2.n, & ch, &f2.d); addfrac(&f1, &f2, &f3); /* */ return 0; 10

15. struct Mount 2 1625 1585 1625m 1585m 16. 2 struct swap 2 1625 1585 1625m 1585m 2 1585m 1625m 11