C++ Primer 读书笔记 - 第一章
2013-05-19 08:02
134 查看
这一章算是简介。
自己写了几个程序。
1. main函数的返回值
2. 对comment的理解
3. 对输入的理解
4. 无限输入
自己写了几个程序。
1. main函数的返回值
int main() { //after ./a.out, execute 'echo $?', it will output 7. return 7; }
2. 对comment的理解
#include <iostream> using namespace std; int main() { cout << "/*"; cout << "*/"; cout << /* "*/" */"; }
3. 对输入的理解
#include <iostream> using namespace std; int main() { int a; int b; cin >> a >> b; cout << a << "\t" << b << endl; return 0; }
4. 无限输入
#include <iostream> using namespace std; int main() { int sum = 0; int value; // Ctrl + D to end the input while (cin >> value) sum += value; cout << "Sum is: " << sum << endl; return 0; }
相关文章推荐
- 【C++ primer】第一章 快速入门 读书笔记
- 《C++ Primer》读书笔记 第一章
- C++ primer 读书笔记--第一章 快速入门
- 《C++ Primer》读书笔记第一章
- 《C++ Primer》读书笔记-第一章 Hello World
- 《C++ Primer》读书笔记(第一章)
- c++ primer 5th 第一章读书笔记
- 《C++ Primer》读书笔记-第一章 入门
- 读书笔记:C++ primer 5th edition--chapter 3.字符串,向量,数组
- 读书笔记:C++ primer 5th edition--chapter8.IO Lib
- 《C++ Primer》读书笔记 第三章 vector、iterator
- 读书笔记:C++ primer 5th edition--chapter15.OOP
- 《Linux多线程服务端编程》读书笔记——第一章_线程安全的对象生命期管理
- 《数据结构教程(第四版)》读书笔记-第一章 绪论
- C++ primer 读书笔记二
- 《大话设计模式》读书笔记(C++代码实现) 第一章:简单工厂模式
- 《C++ Primer》读书笔记-第三章 06 多维数组
- 第一章 代码无错就是优?--简单工厂模式(读书笔记)
- 读书笔记:深入理解计算机系统 第一章
- 第一章 开始 《C++ Primer》