入力
- 1. 01. #include <bits/stdc++.h>
02. using namespace std;
03.
04. int main() {
05. string text;
06. double d;
07. cin >> text;
08. cin >> d;
09. cout << text << ", " << d << endl;
10. }
main関数から処理が始まります
変数
Hello
1.5
入力 出力
- 2. 01. #include <bits/stdc++.h>
02. using namespace std;
03.
04. int main() {
05. string text;
06. double d;
07. cin >> text;
08. cin >> d;
09. cout << text << ", " << d << endl;
10. }
string型の変数textを宣言します
text
変数
Hello
1.5
入力 出力
- 3. 01. #include <bits/stdc++.h>
02. using namespace std;
03.
04. int main() {
05. string text;
06. double d;
07. cin >> text;
08. cin >> d;
09. cout << text << ", " << d << endl;
10. }
double型の変数dを宣言します
text
d
変数
Hello
1.5
入力 出力
- 4. 01. #include <bits/stdc++.h>
02. using namespace std;
03.
04. int main() {
05. string text;
06. double d;
07. cin >> text;
08. cin >> d;
09. cout << text << ", " << d << endl;
10. }
textで入力を受け取ります
textの値は”Hello”になります
text = “Hello”
変数
Hello
1.5
入力 出力
- 5. 01. #include <bits/stdc++.h>
02. using namespace std;
03.
04. int main() {
05. string text;
06. double d;
07. cin >> text;
08. cin >> d;
09. cout << text << ", " << d << endl;
10. }
dで入力を受け取ります
dの値は1.5になります
text = “Hello”
d = 1.5
変数
Hello
1.5
入力 出力
- 6. 01. #include <bits/stdc++.h>
02. using namespace std;
03.
04. int main() {
05. string text;
06. double d;
07. cin >> text;
08. cin >> d;
09. cout << text << ", " << d << endl;
10. }
textとdの値を出力します
Hello, 1.5と出力されます
text = “Hello”
d = 1.5
変数
Hello
1.5
入力
Hello, 1.5
出力
- 7. 01. #include <bits/stdc++.h>
02. using namespace std;
03.
04. int main() {
05. string text;
06. double d;
07. cin >> text;
08. cin >> d;
09. cout << text << ", " << d << endl;
10. }
main関数の}に到達したのでプログラムを終了します
text = “Hello”
d = 1.5
変数
Hello
1.5
入力
Hello, 1.5
出力