C++勉強2日目

時間が空いたが2日目

 

第2章 Helloプログラム

http://codepad.org/5vEVvmIL

 

第3章 計算してみよう

http://codepad.org/TsZyGnP0

#include <iostream>
using namespace std;

int main()
{
cout << "9 / 2 = " << 9 / 2 << endl;
cout << "9 % 2 = " << 9 % 2 << endl;
cout << "2 + 2 * 4 = " << 2 + 2 * 4 << endl;
cout << "(1 - 5) / 2 = " << (1 - 5) / 2 << endl;
return 0;
}

出力

9 / 2 = 4
9 % 2 = 1
2 + 2 * 4 = 10
(1 - 5) / 2 = -2

 

時間が空かないうちに続きができれば良いけど・・・