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

–â‘è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!
1
0
0

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

全文

(1)

C言語Ⅱ 演習(4-4) ~構造体(4)~ 1

C

言語Ⅱ

演習

(4-4)

~構造体

(4)

教科書 12章

以下 問題 関 るプ グラ を作成し,ソースプ グラ を入力後,ビ ,実行し 実行結果を確認し さい. 実行 正しく確認 たら,プ グラ を ポー 用紙 写し,教員あるい TA 確認を受け 提出し さい.

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

問題1. 関数 返値 し 構造体

ま 次 ンバを持 構造体をtypedef宣言を使用し data型

し 準備し さい

char型 配列変数name 配列要素数20 :学生 名前 入

int型 変数 point :数学 試験 点数 入

main関数 こ data型 person[3]を宣言し 以 3名

名前 数学 試験 点数を入力し 構造体を設定し さい

yamada 92点 sato 85点 takahashi 66点

add_point関数を以 う 作 さい

add_point関数 引数 し data型 構造体をひ け

数学 点数を5点追加し 点数 追加さ data型 構造体

を関数 返値 し え も

こ add_point関数を使 data型 person[3] べ 点数を追

加し 3人 名前 5点追加さ 点数 表示さ プログラ

を作成し さい

<ヒント>

関数

data add_point (data student) {

宣言し 関数 中 student.point 点数を5点追加

関数 中 student 呼 い 点 注意 main プログ

ラ person 呼 い さ 値 返却 し return (student); し 構造体を返値 も

一方mainプログラ data型 構造体 あ person[3]を設

定し あ for文を用い 3人分

person[i]=add_point(person[i]);

を行 点数を追加し 情報 person を更新し うえ

値 表示を行え い

実行結果例

yamada 点数 97 りました sato 点数 90 りました takahashi 点数 71 りました

問題2. 構造体 初期化、構造体 ンバ 関数

問題1を改造し 関数 中 名前 最初 文字を XXX 変更

こ 匿名化 名前をわ い状態 し 表示

プログラ を作成し さい え 3 文字目を X

student.name[3]=’X’; い あ いこ

注意

実行結果例

参照

関連したドキュメント

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