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

–â‘è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-1) ~構造体(1)~ 1

C

言語Ⅱ

演習

(4-1)

~構造体

(1)

教科書 12章

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

実行 正しく確認 たら,プ グラ を ポー 用紙 写し,教員あるい TA 確認を受け 提出し さい. お, ポー 用紙 問題番号,学籍番号,氏名を必 書くこ .

問題1. 構造体 型宣言、 ンバ 初期化、 ンバ 使い方

構造体を使 プ グラ あ こ プ グラ い main 関数内 ☆☆☆ あ 3 行 内容を埋め 右 実行結果

う プ グラ を完成させ ポート おい 埋め 部

分 け く プ グラ すべ を写すこ

#include<stdio.h>

struct data { //構造体data 型宣言 char name[20]; // ンバ 19文字入 前 int height; // ンバ 背 高さを入 double weight; // ンバ 体重を入 };

int main(void){

struct data student[2] = { // 2人 ンバ 初期化 {"Jun" , 170, 65.0 }, {"Nero", 160, 51.2 } };

// 構造体 0番目 student[0] 各要素を表示 printf(" 前=%s¥n", ここを埋め ); //☆☆☆ printf("身長=%d[cm]¥n", ここを埋め ); //☆☆☆ printf("体重=%f[kg]¥n", ここを埋め ); //☆☆☆ return 0;

}

実行結果例

名前=Jun 身長=170[cm] 体重=65.0[kg]

問題2. 構造体 typedef宣言

問題1 プ グラ おけ 構造体 型宣言をtypedef宣言を使用

し 書 換え 更 右 う 問題1 異 実行結果を得

う し さい ま student[1] 各要素を表示 し typedef宣言 おい 構造体タグ 省略し 義語をdata し

さい

実行結果例

名前=Nero 身長=160[cm] 体重=51.2[kg]

参照

関連したドキュメント

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