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

050 input

N/A
N/A
Protected

Academic year: 2018

シェア " 050 input"

Copied!
8
0
0

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

全文

(1)

前回 復習8

1.11.5 合計 計算

/* 1.1 1.5 合計 */

#include <stdio.h>

int main(void){

double n;

n = 1.1 + 1.2 + 1.3 + 1.4 + 1.5;

printf("answer=%f¥n", n);

return 0;

}

1

小数点以下

double型'値

格納

用意

1.11.5 算し 変数l

小数点以下

double型' 指定

■コ &注釈'文.

/* */ 囲う.

●複数行 良い

▼こ 実行 影響 与え い.

(2)

文字列 入力

文字列 入力 格納用変数&配列' 出力

#include <stdio.h>

int main(void)

{

char ss[80];

gets(ss);

printf ( 文字列 =%s ¥n , ss);

return 0;

}

2

実行結果

文字列 格納用 変数&配列' 宣言

ssに文字列を入

力す ss 内容 出力

(3)

char ss[80];

80 文字 格納 文字型 変数&配列'

(文字列 し ユ ザ 使用 79 文字 .

文字列 終わ 示 /文字 格納 た .

形式8 char 変数 [使用予定 文字数 +1 ]9

gets(ss);

■ キ ボ &標準入力' ,文字列 入力

使用 . 空白文字 入力 .

形式8 gets &格納先 変数 '

gets() 関数 言う.

&'内 ,正確 ,配列

3

(4)

■ 入力案内 &プ ンプ ' ,printf&'関数 出力文 使用 . [プ グラ 使い易く ]

■ 出力文 入力文 組 合わ .

printf("文字列 入力し 下さい:"); gets(SS);

printf("文字列=%s¥n", ss);

文字列を出力す に ,変換仕様 %s とす .

■入力 gets() 様 ,文字列 出力用 puts()関数 提供

さ い .

形式8 puts"文字列"' 又 puts&文字列型 変数' 例/8 puts(ss);

例08 結果 puts("文字列="); puts(ss);

但し,puts()関数 ,指定さ た文字列を出力す と, 最後に改行を自動的に行う.

4

(5)

数値 入力

scanf関数,数値格納用変数,&

■キ ボ 整数値 入力し ,0倍し,出力

#include <stdio.h> {

int dt;

scanf("%d", &dt); dt = dt * 2;

printf("%d¥n", dt);

return 0; }

5

入力す 数値 格納用変

宣言

dtに整数値を入力

(6)

int dt;

int型&整数値' 格納用変数 宣言

scanf("%d", &dt); int型変数dt ,整数値 入力

scanf()関数

形式8scanf& 書式 , 変数ア ス'

scanf 書式 , 変数ア ス,…,変数ア ス'

( 数値や/文字 入力 ,変数 前 & 付け こ !

( 書式 ,入力先 変数 対応し ,変換仕様 指定 こ .

&型や個数'

書式 ,空白や ¥l あえ ,使用し

し し う.

(0 入力 int a,b;

scanf("%d%d", &a, &b); 6

数値[空白]数値[Enter 形式 入力.

(7)

2.5 前&識別子' 付け方 (P.37-38)

• 変数や,記号定数,関数 前 付け .

べく,意味や機能 付け う.

使用 文字8

ABCDEFGHIJKLMNOPQRSTUVWXYZ 英大文字

_`abcdefghijklmnopqrstuvwx ~ 英小文字

./01234567 ~ 数字 _下線

ルール ,組 合わ

先頭文字 英字,又 _&下線'

長さ 制限 無い ,コンパイラ 識別 先頭31文字

予約語&次 使え &誤

予約語 使え &正しい'

大文字 小文字 区別さ 7

(8)

2.6 a言語 予約語

auto break case char const

continue default do double else

enum extern float for goto

if int long register return

short signed sizeof static struct

switch typedef union unsigned void

volatile while

8

参照

関連したドキュメント

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

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

Power dissipation caused by voltage drop across the LDO and by the output current flowing through the device needs to be dissipated out from the chip. 2) Where: I GND is the

information, product features, availability, functionality, or suitability of its products for any particular purpose, nor does onsemi assume any liability arising out of

また、同法第 13 条第 2 項の規定に基づく、本計画は、 「北区一般廃棄物処理基本計画 2020」や「北区食育推進計画」、

○○でございます。私どもはもともと工場協会という形で活動していたのですけれども、要

The input inrush current has two distinct stages: input charging and output charging. The input charging of a buck stage is usually not controlled, and is limited only by the input