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

–â‘èPDF N‰Èî•ñƒlƒbƒgƒ[ƒN“±“üƒ†ƒjƒbƒg‡UiCŒ¾Œê‡Uj

N/A
N/A
Protected

Academic year: 2018

シェア "–â‘èPDF N‰Èî•ñƒlƒbƒgƒ[ƒN“±“üƒ†ƒjƒbƒg‡UiCŒ¾Œê‡Uj"

Copied!
2
0
0

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

全文

(1)

C言語Ⅱ 総合演習(2) 文 列, インタ,ファイル ~ 1

C

言語Ⅱ

総合演習

(2)

文字列,ポインタ,ファイル

以下 問題 関 るプログラムを作成し,ソースプログラムを入力後,ビルド,実行し 実行結果を確認し さい.

実行 正しく確認 たら,プログラムをレポート用紙 写し,教員あるい TA 確認を受け 提出し さい.

お,レポート用紙 問題番号,学籍番号,氏名を必 書くこ .

問題1. 文字列、文字列 長さ、条件分岐

右 実行結果例 う 2 文 列 キ ボ 読

込 文 列 長さ 長い方 そ 文 数 も 表示

プログラム 作成 さい 双方 も 長さ

場 合 両 方 文 列 そ 長 さ 表 示 こ

strlen()関数 使用 いこ

プログラム 尾 右 う 実行結果 2 種類貼

付け こ

実行結果例

つ目 文 列 入力 く さい

Kanagawa

つ目 文 列 入力 く さい

Tokyo

長い文 列 次 ま (8文 )

> Kanagawa

実行結果例

つ目 文 列 入力 く さい

Kanagawa

つ目 文 列 入力 く さい

Yokohama

つ も 長さ 文 列 (8文 )

> Kanagawa > Yokohama

※ 部 キー ート入力

問題 . 乱数(実数)、ファイル

0.0以 1.0以 実数 乱数 1 万個生成 こ 結果 test522.txtファイル 書 込 プログラム 作成 さい

乱数 プログラム 実行 び 異 数値 生

成 う さい ファイル 数値 書 込

際 数値 1 書 込 毎 改行 こ

※こ プログラム 実行結果 貼 付け く 良い

実行結果例

※ こ プ ロ グ ラ ム 実 行 結 果 何 も

表示さ い

test522.txtファイルが作成

さ い こ そ 内 容 確 認

おくこ

問題 . 乱数(実数)、配列(整数)、ファイル、カウント

問2 作成 test522.txtファイル 1万個 実数値 読

出 次 範囲 値 幾 あ カウン 最後 こ

表示 プログラム 作成 さい

(1) 0.0以 ~0.1 満 値 数 (2) 0.1以 ~0.2 満 値 数 (3) 0.2以 ~0.3 満 値 数 (4) 0.3以 ~0.4 満 値 数 (5) 0.4以 ~0.5 満 値 数 (6) 0.5以 ~0.6 満 値 数 (7) 0.6以 ~0.7 満 値 数 (8) 0.7以 ~0.8 満 値 数 (9) 0.8以 ~0.9 満 値 数 (10)0.9以 ~1.0 満 値 数

記 カウン 際 カウン 値 int型 配列

変数count[10] 宣言 使用 こ

※解答 く い 考察 良い

test522.txt 内容 乱数 発生 数値 あ

確率的 乱数発生 多く繰 返 10種類 も

近い値 カウン く う ?

実行結果例

( 1) 981個

( 2) 1026個

( 3) 1008個

( 4) 1042個

( 5) 1014個

( 6) 979個

( 7) 950個

( 8) 1028個

( 9) 983個

(2)

C言語Ⅱ 総合演習(2) 文 列, インタ,ファイル ~ 2

問題 . 文字列、ファイル

次 4行 学籍番号 半角スペ ス 前 記述

test524.txtファイル 作成 さい

017123 Tanaka

027050 Ogawa

037018 Nomura

047006 Hasegawa

次 右 う 6桁 学籍番号 キ ボ 入力

test524.txt 内 容 読 込 該当 学籍 番号 探

そ 学生 前 表示 プログラム 作成 さい

学籍番号 照合 strcmp()関数 使用 該当

番号 在 い場合 そ 学籍番号 在

表示 う こ

実行結果 右 う 在 学籍番号 在

い学籍番号 2回実行 こ 結果 2 も貼 付け

実行結果例

学籍番号 入力 く さい

047006

学生氏 :Hasegawa

実行結果例

学籍番号 入力 く さい

012345

そ 学籍番号 在 ませ

※ 部 キー ート入力

参照

関連したドキュメント

Theorem 3 implies strong asymptotic stability results: the energy of strong solutions decays to zero, with an explicit decay rate

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,

Actually a similar property shall be first de- rived for a general class of first order systems including the transport equation and Schr¨odinger equations.. Then we shall consider

Hence, the degree theory constructed in [1] is an extension of the classical Leray–Schauder degree in Hilbert space.. It is unique, single-valued and has the usual properties of

Lair and Shaker [10] proved the existence of large solutions in bounded domains and entire large solutions in R N for g(x,u) = p(x)f (u), allowing p to be zero on large parts of Ω..

We prove a continuous embedding that allows us to obtain a boundary trace imbedding result for anisotropic Musielak-Orlicz spaces, which we then apply to obtain an existence result

This concludes the proof that the Riemann problem (1.6) admits a weak solution satisfying the boundary condition in the relaxed sense (1.6c).... The two manifolds are transverse and

This paper is a sequel to [1] where the existence of homoclinic solutions was proved for a family of singular Hamiltonian systems which were subjected to almost periodic forcing...