C 程序设计(谭浩强完整版)(精品课件)(可编辑).doc
文本预览下载声明
C++程序设计(谭浩强完整版)(精品课件)
C++
1C++
C++1946 ENIAC
?
2
20 60 Martin Richards
BCPL
Basic Combined Programming Language 1970
Ken Thompson BCPL
B 1972 Dennis
Ritchie Brian kernighan B ,
C C
UNIX ,C ,
C++ C C
3C
1 C
2
C
C
43 C
4
C
C
C
5C C
C
6C C
1980
Bjarne Stroustrup C
Simula 67
C 1983 Rick Maseitti
C++ C Plus Plus
C++ C++
C++ VC++ Visual C
Plus Plus BC++ Borland C Plus Plus
7
ATT C++C++
*.EXE
*.CPP *.OBJ
compile link
F7
Vitual C++
*.OBJ *.EXE
8C++
#include
void mainvoid
cout“I am a student.\n”; //
DOS
I am a student.
91 Visual C++, “ ” “ ”
? ” “C++ Source File”
2
? ”
3
4 F7 “ ” “ ”
? ” DOS
10VC++
11“File”
?New”
VC++
12“Files”
C++
13C++
C++
1415.cpp .objOS
!
2021Debug
22Debug
obj EXE
23#includevoid mainvoid
cout “i”;//int i; // icin i; // icout “i ” i’\n’; // i
24
25data Program
CPU2000H 3
3+5?
2000H+2002H
2001H
5
2002H
2003H
8
2004H
-128~127
-32768~ 32767
26
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
32767 32767
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 32766 32766
厖 厖”
1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 65535
-2 65534
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
厖
厖
-32767 32769
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
27
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -32768 3276830 40 30.0
40.0
28#include
#define PRICE30 //
void mainvoid
int num, total; // ,
num total num10; // ,10
10totalnum*PRICE; 300cout“total“total; //
PRICE
num10 totalnum*PRICE
3029C++
30…
247
VC++
int ifwhileINT,sum , de12,SUM
31abcEnglish 2xy x-y if Elseb3 ‘def’
Chine_bb b3yAbsFloatfloat
int nCount;
char chChoice;
3231 31
-2 ~ 2 -1 :
1 43134587654
2 0043 056 011
3 0x0x120xa3 0x34 0xdf
33#include
void mainvoid
int int10,int8,int16; // 3
int1010; //
int8010; //
int1010
int160x10; //
int88
coutint10int10endl;
int1616
coutint8int8endl;
coutint16int16endl;
3415 15 short -2 ~ 2 -1
31 31
int -2 ~ 2 -1
-31 31
long -2 ~2 -1
16
unsigned short 0~2 -1
32
unsigned int 0~2 -1
32
unsigned long 0
显示全部