C++超弱者が疑問に思ったことを議事録的にしています。
結論
- 標準出力/入力
- C++でもC言語のprintfやscanfを使うことができるけれども、簡単な記述方法
cout(シーアウト)
- 「
<<
」を出力演算子という - 文字は''(シングルクォーテーション)、文字列は""(ダブルクォーテーション)で囲む
#include <iostream>
std::cout << 【表示内容】;
std::cout << "Hello, World." << std::endl;
std::cout << 100 << std::endl;
- 「
<<
」で表示内容を繋げることができる
std::cout << "I'm " << age << " years old." << std::endl;
cin(シーイン)
- ユーザーのキーボード入力を待つ
- 「
>>
」を入力演算子という
int a;
cin >> a;