0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【C++】基礎備忘録

Last updated at Posted at 2022-10-05

参考

基本

雛形

#include <iostream> 
using namespace std;
int main(){

return 0;
}

using namespace std;を書くことで正式名称を省略できる

定数の定義/変数の宣言(代表的なもの)

//定数
const int NUMBER = 35;//文中のNUMBERを35として扱う

//整数型
int w;//整数を格納
bool x;//true(真)またはfalse(偽)のみ格納可
char y;//文字を1つ格納

//浮動小数点数型
double z;

入出力

int age;
cout << "年齢を入力してください";
cin >> age;
cout << "あなたの年齢は" << age << "です。" << endl; //endlで改行

よく使う構文

if

if(a > 5){
    a - 3;
}else{
    a + 3;
}

for

for(a=1;a<=12;a++){
    cout << a ;
}

while

while(a > 0){
    a=a-1;
}
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?