LoginSignup
5
19

More than 1 year has passed since last update.

【C++】「cin >>」「cout <<」って何?

Last updated at Posted at 2022-03-27

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;
5
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
19