Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
C++ Can Ban

C++ Can Ban

Ratings: (0)|Views: 41 |Likes:
Published by api-3738603

More info:

Published by: api-3738603 on Oct 17, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





Ebooks Team
Trang 1
C++ C\u0103n b\ue000n v\u00e0 n\u00e2ng cao
M\ue000c l\ue000c:

I. C\u01a1 b\ue001n v\ue002 C++ (2)
I. C\ue003u tr\u00fac c\ue004a m\ue005t tr\u01b0\u01a1ng tr\u00ecnh C++ (2)
II. C\u00e1c bi\ue006n ki\ue007u v\u00e0 h\ue008ng s\ue009 (5)

III. C\u00e1c to\u00e1n t\ue00a (13)
IV. Giao ti\ue006p v\ue00bi Console (19)
II. C\u00e1c c\ue003u tr\u00fac \u00f1i\ue002u khi\ue007n v\u00e0 H\u00e0m (22)
I. C\ue003u tr\u00fac d\ue00c li\ue00du \u00f1i\ue002u khi\ue007n (22)
II. H\u00e0m I (29)
III. H\u00e0m II (34)
III. D\ue00c li\ue00du n\u00e2ng cao (41)
I. M\ue00eng (41)

II. S\u00e2u k\u00fd t\ue00f (48)
III. Con tr\ue010 (54)
IV. B\ue005 nh\ue00b \u00f1\ue005ng (65)

V. C\u00e1c c\ue003u tr\u00fac (69)
VI. C\u00e1c ki\ue007u d\ue00c li\ue00du do ng\u01b0\ue011i d\u00f9ng \u00f1\ue012nh ngh\u0129a. (typedef, union, enum) (75)
Ebooks Team
Trang 2
C\ue000u tr\u00fac c\ue001a m\ue002t ch\u01b0\u01a1ng tr\u00ecnh C++
C\u00f3 l\ue000 m\ue001t trong nh\ue002ng c\u00e1ch t\ue003t nh\ue004t\u00f1\ue005 b\ue006t\u00f1\ue007u h\ue008c m\ue001t ng\u00f4n ng\ue002 l\ue009p tr\u00ecnh l\u00e0 b\ue00ang m\ue001t
ch\u01b0\u01a1ng tr\u00ecnh. V\ue009y\u00f1\u00e2y l\u00e0 ch\u01b0\u01a1ng tr\u00ecnh\u00f1\ue007u ti\u00ean c\ue00ba ch\u00fang ta :
// my first program in C++
#include <iostream.h>
int main ()

cout << "Hello World!";
return 0;

Hello World!

Ch\u01b0\u01a1ng tr\u00ecnh tr\u00ean\u00f1\u00e2y l\u00e0 ch\u01b0\u01a1ng tr\u00ecnh\u00f1\ue007u ti\u00ean m\u00e0 h\ue007u h\ue00ct nh\ue002ng ng\u01b0\ue00di h\ue008c ngh\ue00e l\ue009p
tr\u00ecnh vi\ue00ct\u00f1\ue007u ti\u00ean v\u00e0 k\ue00ct qu\ue00f c\ue00ba n\u00f3 l\u00e0 vi\ue00ct c\u00e2u "Hello, World" l\u00ean m\u00e0n h\u00ecnh.\u00f0\u00e2y l\u00e0 m\ue001t
trong nh\ue002ng ch\u01b0\u01a1ng tr\u00ecnh\u00f1\u01a1n gi\ue00fn nh\ue004t c\u00f3 th\ue005 vi\ue00ct b\ue00ang C++ nh\u01b0ng n\u00f3\u00f1\u00e3 bao g\ue010m
nh\ue002ng ph\ue007n c\u01a1 b\ue00fn m\u00e0 m\ue008i ch\u01b0\u01a1ng tr\u00ecnh C++ c\u00f3. H\u00e3y c\u00f9ng xem x\u00e9t t\ue011ng d\u00f2ng m\ue001t :

// my first program in C++
\u00f0\u00e2y l\u00e0 d\u00f2ng ch\u00fa th\u00edch. T\ue004t c\ue00f c\u00e1c d\u00f2ng b\ue006t \u00f1\ue007u b\ue00ang hai d\ue004u s\ue012(// ) \u00f1\u01b0\ue013c coi l\u00e0 ch\u00fat th\u00edch

m\u00e0 ch\u00fang kh\u00f4ng c\u00f3 b\ue004t k\u00ec m\ue001t\ue00fnh h\u01b0\ue014ng n\u00e0o\u00f1 \ue00cn ho\ue015t\u00f1\ue001ng c\ue00ba ch\u01b0\u01a1ng tr\u00ecnh. Ch\u00fang c\u00f3
th\ue005 \u00f1\u01b0\ue013c c\u00e1c l\ue009p tr\u00ecnh vi\u00ean d\u00f9ng\u00f1\ue005 gi\ue00fi th\u00edch hay b\u00ecnh ph\ue016m b\u00ean trong m\u00e3 ngu\ue010n c\ue00ba
ch\u01b0\u01a1ng tr\u00ecnh. Trong tr\u01b0\ue00dng h\ue013p n\u00e0y, d\u00f2ng ch\u00fa th\u00edch l\u00e0 m\ue001t gi\ue00fi th\u00edch ng\ue006n g\ue008n nh\ue002ng g\u00ec
m\u00e0 ch\u01b0\u01a1ng tr\u00ecnh ch\u00fang ta l\u00e0m.

#include <iostream.h>

C\u00e1c c\u00e2u b\ue006t\u00f1\ue007u b\ue00ang d\ue004u (#)\u00f1\u01b0 \ue013c d\u00f9ng cho preprocessor (ai d\ue017ch h\ue001 t\u00f4i t\ue011 n\u00e0y v\ue018i).
Ch\u00fang kh\u00f4ng ph\ue00fi l\u00e0 nh\ue002ng d\u00f2ng m\u00e3 th\ue019c hi\ue01an nh\u01b0ng\u00f1\u01b0 \ue013c d\u00f9ng\u00f1\ue005 b\u00e1o hi\ue01au cho tr\u00ecnh
d\ue017ch.\ue01b\u00f1\u00e2y c\u00e2u l\ue01anh #include <iostream.h> b\u00e1o cho tr\u00ecnh d\ue017ch bi\ue00ct c\ue007n ph\ue00fi
"include" th\u01b0 vi\ue01anio s tre a m.\u00f0\u00e2y l\u00e0 m\ue001t th\u01b0 vi\ue01an v\u00e0o ra c\u01a1 b\ue00fn trong C++ v\u00e0 n\u00f3 ph\ue00fi

\u00f1\u01b0\ue013c "include" v\u00ec n\u00f3 s\ue000 \u00f1\u01b0\ue013c d\u00f9ng trong ch\u01b0\u01a1ng tr\u00ecnh. \u00f0\u00e2y l\u00e0 c\u00e1ch c\ue012 \u00f1i\ue005n \u00f1\ue005s\ue01cd\ue01dng
th\u01b0 vi\ue01anio st rea m
int main ()
D\u00f2ng n\u00e0y t\u01b0\u01a1ng\ue01eng v\ue018i ph\ue007n b\ue006t\u00f1\ue007u khai b\u00e1o h\u00e0mmai n. H\u00e0mmai n l\u00e0\u00f1i\ue005m m\u00e0 t\ue004t c\ue00f
c\u00e1c ch\u01b0\u01a1ng tr\u00ecnh C++ b\ue006t\u00f1\ue007u th\ue019c hi\ue01an. N\u00f3 kh\u00f4ng ph\ue01d thu\ue001c v\u00e0o v\ue017 tr\u00ed c\ue00ba h\u00e0m n\u00e0y (\ue014
\u00f1\ue007u, cu\ue003i hay \ue014gi\ue002a c\ue00ba m\u00e3 ngu\ue010n) m\u00e0 n\ue001i dung c\ue00ba n\u00f3 lu\u00f4n \u00f1\u01b0\ue013c th\ue019c hi\ue01an \u00f1\ue007u ti\u00ean khi
ch\u01b0\u01a1ng tr\u00ecnh b\ue006t\u00f1\ue007u. Th\u00eam v\u00e0o\u00f1\u00f3, do nguy\u00ean nh\u00e2n n\u00f3i tr\u00ean, m\ue008i ch\u01b0\u01a1ng tr\u00ecnh C++\u00f1\ue00eu
ph\ue00fi t\ue010n t\ue015i m\ue001t h\u00e0mma i n.
Theo sauma i n l\u00e0 m\ue001t c\ue01fp ngo\ue01fc\u00f1\u01a1n b\ue014i v\u00ec n\u00f3 l\u00e0 m\ue001t h\u00e0m. Trong C++, t\ue004t c\ue00f c\u00e1c h\u00e0m
m\u00e0 sau\u00f1\u00f3 l\u00e0 m\ue001t c\ue01fp ngo\ue01fc\u00f1\u01a1n () th\u00ec c\u00f3 ngh\u0129a l\u00e0 n\u00f3 c\u00f3 th\ue005 c\u00f3 ho\ue01fc kh\u00f4ng c\u00f3 tham s\ue003

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->