• 検索結果がありません。

鬩滓ヲ邵コォ郢?郢ァソ郢ァ雋陷牙ク吮郢ァ?br/>

N/A
N/A
Protected

Academic year: 2021

シェア "鬩滓ヲ邵コォ郢?郢ァソ郢ァ雋陷牙ク吮郢ァ?br/>"

Copied!
3
0
0

読み込み中.... (全文を見る)

全文

(1)

1

配列にデータを入力する

学習のポイント

キーボードから配列にデータを入力するには次のようにします。 i = 0;

while(scanf("%d", &a[i] != EOF){ i++; }

2

例題

13

配列にデータを入力していき、データ入力後にデータを表示しなさい。 /* 例題13 reidai13.c 終了は「ctl+z」 */ #include <stdio.h> int main() { int i; int n; int point[100]; printf("データを入力してください\n"); n =0;

while(scanf("%d", &point[n]) != EOF){ n++; } for(i = 0; i < n; i++){ printf("%d ", point[i]); } return 0; } 「C言語」(河西朝雄著 ナツメ社)72頁 1

(2)

2.1

練習問題

13

得点を10点幅のランクに分け、その幅に何人いるかカウントするプログラムを作りな さい。 得点の範囲 添え字 配列 1から9 0 hist[0] 10から19 1 hist[1] 20から29 2 hist[2] たとえば、56 点がどこに入るかは 56/10 が 5 なので、この値を配列の添え字にした histo[5]の内容を+1することによりカウントアップできます。 /* 練習問題13 rensyu13.c */ #include <stdio.h> int main() { int i; int dat; int histo[11]; for(i = 0; i < 11; i++){ histo[i] = 0; } printf("得点を入力してください。\n"); while(scanf("%d", &dat) != EOF){

histo[dat / 10]++; }

for(i = 0; i < 11; i++){

printf("%3d : %3d\n", i*10, histo[i]);

(3)

}

return 0; }

「C言語」(河西朝雄著 ナツメ社)73頁

参照

関連したドキュメント

There is a bijection between left cosets of S n in the affine group and certain types of partitions (see Bjorner and Brenti (1996) and Eriksson and Eriksson (1998)).. In B-B,

We establish sharp Br´ezis-Gallou¨et-Wainger type inequalities in Besov and Triebel-Lizorkin spaces as well as fractional Sobolev spaces on a bounded domain Ω ⊂ R n.. We treat

(The Elliott-Halberstam conjecture does allow one to take B = 2 in (1.39), and therefore leads to small improve- ments in Huxley’s results, which for r ≥ 2 are weaker than the result

[r]

“Breuil-M´ezard conjecture and modularity lifting for potentially semistable deformations after

lines. Notice that Theorem 4 can be reformulated so as to give the mean harmonic stability of the configuration rather than that of the separate foliations. To this end it is

S., Oxford Advanced Learner's Dictionary of Current English, Oxford University Press, Oxford

At the end of the section, we will be in the position to present the main result of this work: a representation of the inverse of T under certain conditions on the H¨older