-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathC plus plus primer 5th edition=Stanly B.Lippman;Note=Erxin.txt
68 lines (54 loc) · 1.73 KB
/
C plus plus primer 5th edition=Stanly B.Lippman;Note=Erxin.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
C plus plus primer 5th edition=Stanly B.Lippman;Note=Erxin
# Preface
- added the c++11/c++0x new features
- why read this books
+ low-level language
+ more advanced language features
+ standard library
- introduce common misconceptions and pitfalls
- extensive examples
http://www.informit.com/title/032174113
# Gettting started
- writing a simple c++ program
int main()
{
return 0;
}
- if you are a beginner, the most friendly start point is command-line, then the IDE
- c++ suffix conventions, .cc, .cxx, .cpp, .cp, and .c
- check status of system
+ unix
$ echo $?
+ windows
$ echo %errorlevel%
- window compile command
+ cl, for visual studio
+ for visual studio 2010
cl /EHsc *.cpp
/Ehsc is the option that turn on standard exception handling
- input/output, iostream library, fundamental to iostream are two types istream and ostream. The term stream in intended to suggest that the characters are generated or consumed sequentially over time
+ cin, istream object
+ cout, ostream object
+ cerr, ostream object
+ clog, ostream object
+ example
#include <iostream>
int main()
{
std::cout << "hello world" << std::endl;
}
- all the names defined by standard library are in the std namespace
- comment, //, /* */
- flow of control
+ while statement
while(expression){}
+ for statement
for(init_exp;bool_exp;step_exp){}
+ example read unknown number input values
while(std::cin >> value)
{
sum+= value;
}
- end of file from the keyboard, different operating systems use different conventions
+ window we enter an end-of-file by control+z
+ mac and unix used control+d