You are on page 1of 12

C++ From Ground Up Author: chuong3a, nick yahoo: chuong3a

C++ Is Born.............................................................................................................10 r!"ac! # $%i t&a. 'his (ook t!ach!s you ho) to program in C++ ** th! most po)!r"u+ comput!r +anguag! in us! today. ,o pr!-ious programming !.p!ri!nc! is r!/uir!d. 0o y1u c2u kinh nghi3m +4p tr5nh tr67c 89y. 'h! (ook starts )ith th! (asics :c; (<n=, co-!rs th! "undam!nta+s :8i /ua c>c nguy1n t?c c; (<n=, mo-!s on to th! cor! o" th! +anguag!, and conc+ud!s :k@t thAc= )ith its mor! ad-anc!d "!atur!s :tBnh nCng mD rEng=. CuFn s>ch (?t 82u -7i nhGng 8iHu c; (<n, sau 8I 8i -Jo ph2n trung t9m ngKn ngG -J k@t thAc -7i c>c tBnh nCng mD rEng. By th! tim! you "inish # cho 8@n +Ac (Ln hoJn thJnh, you )i++ (! an accomp+ish!d C++ programm!r :(Ln sM +J 1 +4p tr5nh -i1n C++ thJnh thLo=. C++ is your gat!)ay :c>nh cNng= to mod!rn :s& hi3n 8Li=, o(O!ct*ori!nt!d :h67ng 8Fi t6Png= programming. It is th! pr!!min!nt :6u -i3t= +anguag! "or th! d!-!+opm!nt o" high*p!r"ormanc! so"t)ar! :ph2n mHm cI tBnh hi3u /u< cao= and is th! choic! o" programm!rs )or+d)id!. QI +J ngKn ngG 6u -i3t cho -i3c ph>t triRn ph2n mHm cI tBnh hi3u /u< cao -J +J +&a chSn cTa +4p tr5nh -i1n tr1n toJn th@ gi7i. Uimp+y put, to (! a top*"+ight :8R 8Lt thV hLng cao=, pro"!ssiona+ programm!r today imp+i!s :(ao hJm= comp!t!ncy :nCng +&c= in C++. ,Ii 8;n gi<n, 8R 8Lt thV hLng cao, +4p tr5nh -i1n chuy1n nghi3p c2n cI nCng +&c C++. C++ is mor! than Oust a popu+ar +anguag!. C++ cWn h;n +J 1 ngKn ngG phN (i@n. C++ pro-id!s :cung cXp= th! conc!ptua+ su(strata :kh>i ni3m c; (<n= that und!r+i! th! d!sign :+Jm c; sD cho thi@t k@= o" s!-!ra+ oth!r +anguag!s, and much o" mod!rn computing. C++ cung cXp c>c kh>i ni3m c; (<n +Jm c; sD cho thi@t k@ cTa nhiHu ngKn ngG kh>c, -J nhiHu cKng cY tBnh to>n hi3n 8Li. It is no accid!nt :s& rTi ro= that t)o oth!r important +anguag!s, Za-a and C[, ar! d!sc!nd!d :dc gi<m .uFng= "rom C++. 'h!r! is +itt+! in programming that has not (!!n in"+u!nc!d :ko ch\u <nh h6Dng= (y th! synta. :cA ph>p=, sty+! :kiRu 8\nh dLng=, and phi+osophy :tri@t +B, cXu trAc thi@t k@= o" C++. B!caus! C++ )as d!sign!d "or pro"!ssiona+ programming, C++ is not th! !asi!st programming +anguag! to +!arn. It is, ho)!-!r :tuy nhi1n=, th! (!st programming +anguag! to +!arn. ]nc! you ha-! mast!r!d :hiRu r^= C++, you )i++ (! a(+! to )rit! pro"!ssiona+*/ua+ity, high* p!r"ormanc! programs. 1 khi (Ln hiRu r_ C++, (Ln sM -i@t 86Pc nhGng ch6;ng tr5nh cI tBnh chuy1n ngi3p -J chXt +6Png cao. `ou )i++ a+so (! a(+! to !asi+y +!arn +anguag!s +ik! Za-a or C[ (!caus! th!y shar! th! sam! (asic synta. and d!sign as C+ +. BLn cang sM db dJng hSc c>c ngKn ngG kh>c nh6 Za-a or C[ (Di -5 chAng chia sc cdng nHn t<ng cA ph>p -J thi@t k@ nh6 C++. ehat Is ,!) in th! 'hird fdition :+2n t>i (<n thV 3= In th! tim! that has pass!d sinc! th! pr!-ious !dition o" this (ook, th!r! ha-! (!!n no chang!s to th! C++ +anguag!. 'g +2n t>i (<n tr67c cTa cuFn s>ch nJy 8@n nay, ko cI

nhiHu s& thay 8Ni trong ngKn ngG C++. 'h!r! ha-!, ho)!-!r, (!!n (ig chang!s to th! computing !n-ironm!nt. 'uy nhi1n cI s& thay 8Ni +7n trong mKi tr6%ng tBnh to>n. For !.amp+!, Za-a (!cam! th! dominant :-6Pt trEi= +anguag! "or e!( programming, th! .,f' Fram!)ork )as r!+!as!d :86Pc ph>t hJnh=, and C[ )as in-!nt!d :86Pc ph>t minh=. 'hrough a++ th! chang!s o" th! past "!) y!ars, on! thing has r!main!d constant: th! staying po)!r o" C++. huy1n suFt nhGng thay 8Ni cTa 1 -Ji nCm g2n 89y, 1 thV -in cWn +Li (Xt (i@n, s& cWn +Li cTa sVc mLnh ngKn ngG C++. C++ has (!!n, is, and )i++ r!main th! dominant +anguag! o" jpo)!r programm!rsj )!++ into th! "ors!!a(+! "utur!. C++ 8k, 8ang -J sM +uKn +J ngKn ngG :+4p tr5nh= thFng tr\ cTa jnhGng +4p tr5nh -i1n /uyHn +&cj trong t6;ng +ai kh< ki@n. 'h! o-!ra++ structur! :cXu trAc toJn thR= and organilation :s& tN chVc= o" th! third !dition :+2n t>i (<n thV 3= is simi+ar :t6;ng t&= to th! s!cond !dition. most o" th! chang!s in-o+-! :(ao gnm= updating and !.panding :c4p nh4t -J mD rEng= th! co-!rag! throughout :.uy1n suFt toJn (E=. In som! cas!s :trong 1 sF tr6%ng hPp=, additiona+ d!tai+s :chi ti@t= )!r! add!d. In oth!r cas!s, th! pr!s!ntation :s& tr5nh (Jy= o" a topic :chT 8H= )as impro-!d :86Pc c<i ti@n=. In sti++ oth!r situations :trong nhGng hoJn c<nh kh>c=, d!scriptions :s& mi1u t<= )!r! mod!rnil!d :86Pc hi3n 8Li= to r!"+!ct :8R ph<n >nh= th! curr!nt programming !n-ironm!nt. 'rong nhGng ph2n kh>c, s& mi1u t< 86Pc hi3n 8Li 8R ph<n >nh mKi tr6%ng +4p tr5nh hi3n nay. U!-!ra+ n!) s!ctions )!r! a+so add!d. ,hiHu ph2n m7i cang 86Pc th1m -Jo. ')o app!ndic!s :(<n phY +Yc= )!r! add!d. ]n! d!scri(!s :tr5nh (Jy= th! !.t!nd!d k!y)ords d!"in!d :nhGng tg khIa mD rEng 86Pc ph>t triRn= (y microso"t that ar! us!d "or cr!ating manag!d cod! :cod! /u<n +B= "or th! .,f' Fram!)ork. 'h! s!cond !.p+ains :s& gi<i thBch= ho) to adapt :c>ch thBch nghi= th! cod! in this (ook "or us! )ith an o+d!r, non*standard C++ compi+!r :tr5nh (i1n d\ch=. Fina++y, a++ cod! !.amp+!s )!r! r!t!st!d against :kiRm tra d&a -Jo= th! curr!nt crop o" compi+!rs :tr5nh (i1n d\ch hi3n th%i=, inc+uding microso"tos pisua+ Utudio .,f' and Bor+andos C++ Bui+d!r. CuFi cdng, c>c cod! mqu 8k 86Pc kiRm tra d&a -Jo tr5nh (i1n d\ch hi3n th%i. ehat p!rsion o" C++ 'h! mat!ria+ :nEi dung= in this (ook d!scri(!s :tr5nh (Jy= Utandard C++. 'his is th! -!rsion :phi1n (<n= o" C++ d!"in!d :86Pc 8\nh nghra= (y th! A,UIsIU] Utandard "or C++, and it is th! on! that is curr!nt+y support!d (y a++ maOor compi+!rs :-J 86Pc ht trP (Di tXt c< tr5nh (i1n d\ch chBnh=. 'h!r!"or! :do 8I=, using this (ook, you can (! con"id!nt :t& tin= that )hat you +!arn today )i++ a+so app+y :Vng dYng= tomorro). uo) to Us! 'his Book 'h! (!st )ay :c>ch tFt nhXt= to +!arn any programming +anguag!, inc+uding C++, is (y doing :th&c hJnh=. 'h!r!"or! :do 8I=, a"t!r you ha-! r!ad through a s!ction :8Sc .uy1n suFt 1 ph2n=, try th! samp+! programs. mak! sur! that you und!rstand )hy th!y do )hat th!y do (!"or! mo-ing on. Ch?c ch?n rvng (Ln hiRu tLi sao hS +Jm nh6 th@ tr67c khi 8i ti@p. `ou shou+d a+so !.p!rim!nt :thw nghi3m= )ith th! programs, changing on! or t)o +in!s at a tim! and o(s!r-ing :/uan s>t= th! r!su+ts :k@t /u<=. 'h!

mor! you program, th! (!tt!r you (!com! at programming. BLn +4p tr5nh nhiHu h;n, (Ln sM gi^i h;n. I" `ouor! Using eindo)s I" your comput!r us!s eindo)s and your goa+ :mYc ti1u= is to )rit! eindo)s*(as!d programs, th!n you ha-! chos!n th! right +anguag! to +!arn. C++ is comp+!t!+y at hom! :hoJn toJn t6;ng thBch= )ith eindo)s programming. uo)!-!r, non! o" th! programs in this (ook us! th! eindo)s graphica+ us!r int!r"ac! :GUI= :giao di3n 8n hSa ng6%i ddng=. Inst!ad :thay -5=, th!y ar! conso+!*(as!d programs :ch6;ng tr5nh giao ti@p c; (<n= that can (! run und!r a eindo)s conso+! s!ssion :mJ cI thR chLy (1n d67i giao di3n eindo)s=, such as :t6;ng t& nh6= that pro-id!d :ch6;ng tr5nh 86Pc cung cXp (Di= (y th! Command rompt )indo). 'h! r!ason "or this is !asy to und!rstand :+B do cho 8iHu nJy +J db hiRu=: GUI*(as!d eindo)s programs ar!, (y th!ir natur!, +arg! and comp+!. :cI tBnh chXt +7n -J phVc tLp=. 'h!y a+so us! many t!chni/u!s :kr thu4t= not dir!ct+y r!+at!d :ko +i1n /uan tr&c ti@p= to th! C++ +anguag!. 'hus :do 8I=, th!y ar! not )!++*suit!d :ko 86Pc 8H c4p 8@n= "or t!aching a programming +anguag!. uo)!-!r, you can sti++ us! a eindo)s*(as!d compi+!r to compi+! :(i1n d\ch # th&c thi= th! programs in this (ook (!caus! th! compi+!r )i++ automatica++y cr!at! a conso+! s!ssion :ph2n giao di3n= in )hich to !.!cut! :8R th&c thi= your program. ]nc! you ha-! mast!r!d :1 khi (Ln 8k gi^i= C++, you )i++ (! a(+! to app+y your kno)+!dg! to eindo)s programming. In "act :th&c t@ +J=, eindo)s programming using C++ a++o)s :cho phxp= th! us! o" c+ass +i(rari!s :+7p th6 -i3n= such as mFC or th! n!)!r .,f' Fram!)ork, )hich can gr!at+y simp+i"y :cI thR +Jm 8;n gi<n= th! d!-!+opm!nt o" a eindo)s program. yonot Forg!t: Cod! on th! e!( z!m!m(!r, th! sourc! cod! :mk ngunn= "or a++ o" th! programs in this (ook is a-ai+a(+! "r!! o" charg! :mibn phB= on th! e!( at http:ss))).os(orn!.com. yo)n+oading this cod! pr!-!nts :ngCn c<n= you "rom ha-ing to typ! in th! !.amp+!s. For Furth!r Utudy # Cho s& nghi1n cVu ti@p C++"rom th! Ground Up is your gat!)ay to th! u!r( Uchi+dt s!ri!s o" programming (ooks. u!r! ar! som! oth!rs that you )i++ "ind o" int!r!st. 'o +!arn mor! a(out C++, try C++: 'h! Comp+!t! z!"!r!nc! :s& tham kh<o 82y 8T= C++: A B!ginn!ros Guid! '!ach `ours!+" C++ U'$ rogramming From th! Ground Up C++ rogramm!ros z!"!r!nc! 'o +!arn a(out Za-a programming, )! r!comm!nd th! "o++o)ing: Za-a {: A B!ginn!ros Guid! Za-a {: 'h! Comp+!t! z!"!r!nc! Za-a { rogramm!ros z!"!r!nc! 'o +!arn a(out C[, u!r( o""!rs :8H ngh\= th!s! (ooks:

C[: A B!ginn!ros Guid! C[: 'h! Comp+!t! z!"!r!nc! 'o +!arn a(out eindo)s programming )! sugg!st :8H ngh\= th! "o++o)ing Uchi+dt (ooks: eindo)s |} rogramming From th! Ground Up eindo)s {000 rogramming From th! Ground Up mFC rogramming From th! Ground Up 'h! eindo)s rogramming Annotat!d Archi-!s :(<n +6u chA thBch= I" you )ant to +!arn a(out th! C +anguag!, )hich is th! "oundation :c; sD= o" a++ mod!rn programming, th!n th! "o++o)ing tit+!s )i++ (! o" int!r!st. C: 'h! Comp+!t! z!"!r!nc! '!ach `ours!+" C eh!n you n!!d so+id ans)!rs :nhGng c9u h^i +i1n tYc=, "ast, turn to :8@n g~p= u!r(!rt Uchi+dt, th! r!cognil!d authority on programming :chuy1n gia 8k 86Pc cKng nh4n trong +4p tr5nh=. 'h! Utory o" C++ C++ is th! sing+! most important +anguag! that any programm!r can +!arn. C++ +J 1 ngKn ngG +4p tr5nh 8;n gi<n /uan trSng nhXt mJ (Xt cV +4p tr5nh -i1n nJo cang cI thR hSc. 'his is a strong stat!m!nt :89y +J s& tr5nh (Jy mLnh mM=, (ut it is not an !.agg!ration :s& c6%ng 8i3u=. C++ is th! c!nt!r o" gra-ity :trSng t9m= around :.ung /uanh= )hich a++ o" mod!rn programming r!-o+-!s. C++ +J trSng t9m mJ tXt c< nhGng ngKn ngG hi3n 8Li kh>c .oay /uanh. Its synta. and d!sign phi+osophy d!"in! th! !ss!nc! o" o(O!ct*ori!nt!d programming. CXu trAc c9u +3nh -J thi@t k@ d&a tr1n (<n chXt cTa ch6;ng tr5nh h67ng 8Fi t6Png. mor!o-!r :h;n nGa=, C++ charts th! cours! "or "utur! +anguag! d!-!+opm!nt. u;n nGa, C++ -M (iRu 8n ti@n tr5nh cho s& ph>t triRn cTa ngKn ngG t6;ng +ai. For !.amp+!, (oth Za-a and C[ ar! dir!ct+y d!sc!nd!d :86Pc (?t ngunn tr&c ti@p= "rom C++. C++ is a+so th! uni-!rsa+ +anguag! :ngKn ngG /uFc t@= o" programming it is th! +anguag! in )hich programm!rs shar! id!as )ith on! anoth!r. 'o (! a pro"!ssiona+ programm!r today imp+i!s comp!t!ncy :phY thuEc nCng +&c= in C++. It is that "undam!nta+ and that important. QI +J nguy1n t?c c; (<n -J /uan trSng. C++ is th! gat!)ay to a++ o" mod!rn programming. B!"or! (!ginning your study o" C++, it is important "or you to kno) ho) C++ "its into th! historica+ cont!.t :khung c<nh +\ch sw= o" comput!r +anguag!s. 'r67c khi (?t 82u hSc C++, (Ln cang n1n (i@t C++ ra 8%i nh6 th@ nJo trong +\ch sw cTa ngKn ngG m>y tBnh. Und!rstanding th! "orc!s :t>c 8Eng= that dro-! :dqn 8@n= its cr!ation :s& ki@n tLo=, th! d!sign phi+osophy it r!pr!s!nts :/uan 8iRm thi@t k@ 86Pc tr5nh (Jy=, and th! +!gacy :s& thga k@= that it inh!rits :thga h6Dng= mak!s it !asi!r to appr!ciat! :8>nh gi>= th! many inno-ati-! :tBnh 8Ni m7i, tBnh s>ng tLo= and uni/u! :tBnh 8Ec 8>o, duy nhXt= "!atur!s :tBnh nCng= o" C++. pi3c hiRu r_ nhGng t>c 8Eng dqn 8@n s& ki@n tLo C++, tr5nh (Jy cXu trAc thi@t k@, -J c; cXu +4p tr5nh ca mJ C++ thga h6Dng sM giAp 8>nh gi> cao nhGng 8~c 8iRm s>ng tLo -J 8Ec 8>o cTa C++ mEt c>ch db dJng h;n. eith this in mind :-7i t6 duy nJy=, this chapt!r pr!s!nts :tr5nh (Jy= a (ri!"

history :+6Pc sw= o" th! C++ programming +anguag!, its origins :ngunn gFc cTa nI=, its r!+ationship :mFi /uan h3= to its pr!d!c!ssor :C= :ngKn ngG tr67c 8I=, its us!s :c>ch ddng=, and th! programming phi+osophi!s :cXu trAc +4p tr5nh= that it supports :ht trP=. It a+so puts C++ into p!rsp!cti-! :khung c<nh= r!+ati-! to oth!r programming +anguag!s. Ch6;ng nJy cang 8~t ngKn ngG C++ -Jo khung c<nh /uan h3 -7i c>c ngKn ngG kh>c. 'h! ]rigins o" C++ # ,gunn gFc cTa C++ 'h! story o" C++ (!gins )ith C. 'h! r!ason :+B do= "or this is simp+!: C++ is (ui+t upon th! "oundation :c; sD= o" C. In "act :th&c t@ +J=, C++ is a sup!rs!t :t4p +7n= o" C. :Ind!!d :th&c -4y=, a++ C++ compi+!rs :tr5nh d\ch= can a+so (! us!d to compi+! :(i1n d\ch= C programs Up!ci"ica++y :1 c>ch cY thR=, C++ is an !.pand!d :mD rEng= and !nhanc!d :n9ng cao= -!rsion :phi1n (<n= o" C that !m(odi!s :(ao gnm= th! phi+osophy :/uan 8iRm= o" o(O!ct*ori!nt!d programming :+4p tr5nh h67ng 8Fi t6Png= :)hich is d!scri(!d :86Pc mK t<= +at!r in this chapt!r=. C++ a+so inc+ud!s :(ao gnm= s!-!ra+ oth!r impro-!m!nts :nhiHu c<i ti@n kh>c= to th! C +anguag!, inc+uding an !.t!nd!d s!t o" +i(rary routin!s :t4p hPp th6 -i3n ch6;ng tr5nh con mD rEng=. uo)!-!r, much o" th! spirit :tinh th2n= and "+a-or :h6;ng -\= o" C++ is inh!rit!d dir!ct+y :86Pc thga k@ tr&c ti@p= "rom C. 'o "u++y und!rstand and appr!ciat! :8>nh gi>= C++, you n!!d to und!rstand th! jho) and )hyj (!hind :8vng sau= C. 'h! Cr!ation o" C # U& ra 8%i cTa C 'h! C +anguag! shook :+Jm khuXy 8Eng= th! comput!r )or+d. Its impact :s& t>c 8Eng cTa nI= shou+d not (! und!r!stimat!d :ko n1n 8>nh gi> thXp= (!caus! it "undam!nta++y :-H c; (<n= chang!d th! )ay programming )as approach!d :8k g2n nh6= and thought a(out. 'a ko n1n 8>nh gi> thXp s& t>c 8Eng cTa ngKn ngG C, (Di -5 nI 8k thay 8Ni c; (<n c>ch +4p tr5nh. C is consid!r!d :86Pc /uan t9m= (y many to (! th! "irst mod!rn jprogramm!ros +anguag!.j rior to th! in-!ntion o" C :tr67c khi cI s& ph>t minh cTa C=, comput!r +anguag!s )!r! g!n!ra++y d!sign!d :86Pc thi@t k@ chung= !ith!r as :cho c<= acad!mic !.!rcis!s :(Ji t4p hJn +9m= or (y (ur!aucratic committ!!s :(an ngJnh cKng chVc=. C is di""!r!nt. C )as d!sign!d, imp+!m!nt!d :86Pc th&c thi=, and d!-!+op!d (y r!a+, )orking programm!rs, and it r!"+!ct!d :ph<n >nh= th! )ay th!y approach!d :c>ch nh5n nh4n= th! Oo( o" programming. C 86Pc thi@t k@, th&c thi -J ph>t triRn (Di th&c t@, -i3c +4p tr5nh -J nI ph<n >nh c>ch chAng ta nh5n nh4n -H +4p tr5nh. Its "!atur!s )!r! hon!d :8k 86Pc mJi daa=, t!st!d, thought a(out :suy nghr -H=, and r!thought :c9n nh?c= (y th! p!op+! )ho actua++y us!d th! +anguag!. ,hGng tBnh nCng cTa nI 8k 86Pc mJi daa, kiRm tra, suy nghr -H -J c9n nh?c (Di nhGng ng6%i 8k th4t s& ddng ngKn ngG C. 'h! r!su+t :k@t /u<= o" this proc!ss :ti@n tr5nh= )as a +anguag! that programm!rs +ik!d to us!. Ind!!d :th4t -4y=, C /uick+y attract!d :hXp dqn= many "o++o)!rs )ho had a n!ar*r!+igious l!a+ "or it, and it "ound )id! and rapid acc!ptanc! :nI 86Pc chXp nh4n rEng rki -J nhanh chIng= in th! programm!r community :cEng 8nng=. In short :1 c>ch ng?n gSn=, C is a +anguag! d!sign!d (y and "or programm!rs. C )as in-!nt!d :86Pc ph>t minh= and "irst imp+!m!nt!d :th&c thi= (y y!nnis zitchi! on a yfC y *11 using th! U,Ih op!rating syst!m :h3 8iHu hJnh Uni.=. C is th! r!su+t o" a d!-!+opm!nt proc!ss that

start!d )ith an o+d!r +anguag! ca++!d BC $, )hich )as d!-!+op!d (y martin zichards. C +J k@t /u< cTa ti@n tr5nh ph>t triRn (?t 82u tg 1 ngKn ngG ca h;n +J BC $, 86Pc ph>t triRn (Di martin zichards. BC $ in"+u!nc!d :<nh h6Dng 8@n= a +anguag! ca++!d B, in-!nt!d (y 0!n 'hompson, )hich +!d :8k dqn t7i # /u> khV cTa +!ad= to th! d!-!+opm!nt o" C in th! 1|0s. For many y!ars, th! d! "acto standard :chuin phN (i@n= "or C )as th! on! supp+i!d :86Pc cung cXp duy nhXt= )ith th! Uni. op!rating syst!m and d!scri(!d :86Pc mK t<= in 'h! C rogramming $anguag!, (y Brian 0!rnighan and y!nnis zitchi! : r!ntic!* ua++, 1|}=. uo)!-!r, (!caus! no "orma+ standard :chuin chBnh thVc= !.ist!d :tnn tLi=, th!r! )!r! discr!panci!s :s& kh>c nhau= (!t)!!n di""!r!nt imp+!m!ntations :ch6;ng tr5nh th&c thi= o" C. 'o a+t!r this situation, a committ!! )as !sta(+ish!d in th! (!ginning o" th! summ!r o" 1|}3 to )ork on th! cr!ation o" an A,UI :Am!rican ,ationa+ Utandards Institut!= standard that )ou+d d!"in!*onc! and "or a++*th! C +anguag!. QR thay 8Ni hoJn c<nh nJy, 1 u (an 86Pc thJnh +4p -Jo 82u mda h nCm 1|}3 8R +Jm -i3c tLo ra chuin A,UI 86Pc 8\nh nghra cho tXt c< ngKn ngG C. 'h! "ina+ -!rsion o" th! standard )as adopt!d :86Pc chXp nh4n= in y!c!m(!r 1|}|, th! "irst copi!s o" )hich (!cam! a-ai+a(+! :cI gi> tr\= in !ar+y 1||0. 'his -!rsion o" C is common+y r!"!rr!d to as C}|, and it is th! "oundation upon )hich C++ is (ui+t. hi1n (<n nJy cTa C thKng th6%ng 86Pc .!m nh6 C}|, -J nI +J c; sD mJ C++ d&a tr1n. 'h! C standard )as updat!d in 1||| and this -!rsion o" C is usua++y r!"!rr!d :86Pc gSi +J, 86Pc tham chi@u nh6 +J, 86Pc .!m nh6= to as C||. 'his -!rsion contains :chVa= som! n!) "!atur!s :tBnh nCng=, inc+uding :(ao gnm= a "!) (orro)!d :m6Pn= "rom C++, (ut, o-!ra++ # nIi chung, it is compati(+! :t6;ng thBch= )ith th! origina+ C}| standard :chuin C}| (an 82u=. At th! tim! o" this )riting, no )id!+y a-ai+a(+! compi+!r supports C|| and it is sti++ C}| that d!"in!s )hat is common+y thought o" as th! C +anguag!. 'Li th%i 8iRm (Ji -i@t 8H c4p, ko 1 tr5nh (i1n d\ch nJo ht trP C|| -J nI -qn +J C}| # 8\nh nghra thKng th6%ng cTa ngKn ngG C. Furth!rmor! :h;n nGa=, it is C}| that is th! (asis :nHn t<ng= "or C++. It is possi(+! that a "utur! standard "or C+ + )i++ inc+ud! th! "!atur!s add!d (y C||, (ut th!y ar! not part o" C++ at this tim!. CI kh< nCng chuin t6;ng +ai cTa C++ sM (ao gnm nhGng tBnh nCng tg C||, nh6ng chAng ko ph<i +J 1 ph2n cTa C++ -Jo th%i 8iRm nJy. It may s!!m hard to und!rstand at "irst, (ut C is o"t!n ca++!d a midd+!*+!-!+ comput!r +anguag!. CI thR +J khI khCn 8R hiRu -Jo +Ac 82u, nh6ng C th6%ng 86Pc gSi +J ngKn ngG m>y tBnh cXp trung. As it is app+i!d to C, midd+!*+!-!+ do!s not ha-! a n!gati-! connotation p5 nI sM 86Pc >p dYng cho C, mVc 8E trung (5nh hi3n khKng cI nghra ti1u c&c it do!s not m!an that C is +!ss po)!r"u+, hard!r to us!, or +!ss d!-!+op!d than a high*+!-!+ +anguag!, or that it is as di""icu+t to us! as ass!m(+y +anguag!. QiHu 8I ko cI nghra rvng C kxm hi3u /u<, khI sw dYng, or Bt ph>t triRn h;n +J ngKn ngG +4p tr5nh cao cXp kh>c, or khI ddng nh6 ngKn ngG ass!m(+y. :Ass!m(+y +anguag!, or ass!m(+!r, as it is o"t!n ca++!d, is simp+y a sym(o+ic r!pr!s!ntation o" th! actua+ machin! cod! that a comput!r can !.!cut!. ,gKn ngG Ass!m(+y, or ass!m(+!r nh6 th6%ng gSi, +J nhGng kB t& 8Li di3n 8;n gi<n cTa mk m>y mJ comput!r cI thR

th&c thi=. C is thought o" as :86Pc .!m +J= a midd+!*+!-!+ +anguag! (!caus! it com(in!s !+!m!nts :y@u tF= o" high*+!-!+ +anguag!s, such as asca+, modu+a*{, or pisua+ Basic, )ith th! "unctiona+ity :chVc nCng= o" ass!m(+!r. From a th!or!tica+ point o" -i!) # 8Vng tg /uan 8iRm +B thuy@t, a high*+!-!+ +anguag! att!mpts to gi-! th! programm!r !-!rything h! or sh! cou+d possi(+y )ant, a+r!ady (ui+t into :tBch hPp -Jo= th! +anguag! # ngKn ngG +4p tr5nh cXp cao cF g?ng cho +4p tr5nh -i1n nhGng g5 anh Xy cI thR muFn, ngay c< tBch hPp -Jo ngKn ngG. A +o)*+!-!+ +anguag! pro-id!s nothing oth!r than acc!ss to th! actua+ machin! instructions :ch +3nh=. ,gKn ngG cXp thXp cung cXp ko g5 kh>c h;n +J truy nh4p -Jo ch +3nh m>y. A midd+!*+!-!+ +anguag! gi-!s th! programm!r a concis! :ng?n gSn, sAc tBch= s!t o" too+s and a++o)s th! programm!r to d!-!+op high!r*+!-!+ constructs on his or h!r o)n. ,gKn ngG midd+!*+!-!+ cho +4p tr5nh -i1n 1 t4p hPp c>c cKng cY ng?n gSn -J cho phxp ph>t triRn c>c cXu trAc (4c cao cTa ri1ng anh ta. A midd+!*+!-!+ +anguag! o""!rs :8H ngh\= th! programm!r (ui+t*in po)!r :tBch hPp sVc mLnh=, coup+!d )ith "+!.i(i+ity :8i 8Ki -7i tBnh +inh hoLt=. B!ing a midd+!*+!-!+ +anguag!, C a++o)s you to manipu+at! :8iHu khiRn= (its, (yt!s, and addr!ss!s # th! (asic !+!m!nts :y@u tF c; (<n= )ith )hich a comput!r "unctions :chVc nCng m>y tBnh=. 'hus, C do!s not att!mpt :cF g?ng= to (u""!r th! hard)ar! o" th! machin! "rom your program to any signi"icant !.t!nt :phLm -i cI nghra=. p5 -4y, C khKng cF g?ng 8R chi@m +Xy (E 83m ph2n cVng cTa m>y tBnh tg ch6;ng tr5nh nJo cI mVc 8E 8>ng kR. For !.amp+!, th! sil! o" an int!g!r in C is dir!ct+y r!+at!d :86Pc +i1n /uan tr&c ti@p= to th! )ord sil! o" th! C U. eord sil! # kBch th67c tg cTa C U: th! num(!r o" (its that a C U can proc!ss at on! tim!. In most high*+!-!+ +anguag!s th!r! ar! (ui+t*in stat!m!nts :c9u +3nh tBch hPp sn= "or r!ading and )riting disk "i+!s. In C, a++ o" th!s! proc!dur!s :thT tYc, ti@n tr5nh= ar! p!r"orm!d :86Pc th&c hi3n= (y ca++s to +i(rary routin!s :th6 -i3n ch6;ng tr5nh con= and not (y k!y)ords d!"in!d (y th! +anguag!. 'his approach :g2n nh6, giFng nh6, ti@p c4n, gi<i ph>p= incr!as!s Cs "+!.i(i+ity. Gi<i ph>p nJy dqn t7i tCng tBnh +inh hoLt cTa C. C a++o)sind!!d :th4t -4y=, n!!dsth! programm!r to d!"in! routin!s "or p!r"orming high*+!-!+ op!rations. 'h4t -4y, C cho phxp, c2n +4p tr5nh -i1n .>c 8\nh c>c ch6;ng tr5nh 8R cI thR +Jm -i3c D mVc 8E cao h;n. 'h!s! routin!s :ch6;ng tr5nh con= ar! ca++!d "unctions, and th!y ar! -!ry important to th! C +anguag!. In "act, "unctions ar! th! (ui+ding (+ocks o" (oth C and C++. 'r1n th&c t@, hJm +J c>c khFi 86Pc .9y d&ng trong C -J C++. `ou can !asi+y tai+or :8iHu chnh= a +i(rary o" "unctions to p!r"orm -arious tasks :nhGng nhi3m -Y kh>c nhau= that ar! us!d (y your program. In this s!ns! # trong nghra nJy, you can p!rsona+il! :c> nh9n ho>= C to "it your n!!ds. 'rong nghra nJy, (Ln cI thR c> nh9n ho> C cho thBch hPp -7i y1u c2u cTa (Ln. 'h!r! is anoth!r asp!ct :khBa cLnh kh>c= o" C that you must und!rstand, (!caus! it is a+so important to C++: C is a structur!d +anguag! :ngKn ngG cXu trAc=. 'h! most distinguishing "!atur! :tBnh nCng ti1u (iRu= o" a structur!d +anguag! is that it us!s

(+ocks. h2n +7n nhGng tBnh nCng ti1u (iRu cTa ngKn ngG cXu trAc +J chAng ddng khFi. A (+ock is a s!t o" stat!m!nts that ar! +ogica++y conn!ct!d. 1 khFi +J 1 t4p hPp c>c c9u +3nh 86Pc k@t nFi +ogic. For !.amp+!, imagin! an IF stat!m!nt that, i" succ!ss"u+, )i++ !.!cut! "i-! discr!t! :ri1ng (i3t, r%i rLc= stat!m!nts. I" th!s! stat!m!nts can (! group!d tog!th!r and r!"!r!nc!d as an indi-isi(+! unit :1 8;n -\ ko thR chia nh^=, th!n th!y "orm :tLo thJnh= a (+ock. A structur!d +anguag! supports th! conc!pt :kh>i ni3m= o" su(routin!s :ch6;ng tr5nh con= )ith +oca+ -aria(+!s :(i@n cYc (E= . A +oca+ -aria(+! is simp+y a -aria(+! that is kno)n on+y to th! su(routin! in )hich it is d!"in!d. A structur!d +anguag! a+so supports s!-!ra+ +oop constructs :cXu trAc nhiHu -Wng +~p=, such as )hi+!, do*)hi+!, and "or. 'h! us! o" th! goto stat!m!nt, ho)!-!r, is !ith!r prohi(it!d :ngCn cXm= or discourag!d :nCng c<n=, and is not th! common "orm o" program contro+ in th! sam! )ay that it is in traditiona+ BAUIC or F]z'zA,. C>ch ddng cTa c9u +3nh goto, tuy nhi1n, (\ hLn ch@, -J nI ko ph<i +J dLng thKng th6%ng cTa ch6;ng tr5nh 8iHu khiRn trong cdng 1 c>ch thVc nh6 +J trong nhGng ngKn ngG truyHn thFng BAUIC or F]z'zA,. A structur!d +anguag! a++o)s you to ind!nt :canh +H= stat!m!nts and do!s not r!/uir! a strict "i!+d conc!pt :kh>i ni3m chBnh .>c= :as did !ar+y -!rsions o" F]z'zA, # nh6 nhGng phi1n (<n 82u ti1n cTa F]z'zA,=. Fina++y, and p!rhaps most important+y, C is a +anguag! that stays out o" th! )ay. CuFi cdng -J cI +M /uan trSng nhXt, C +J ngKn ngG nvm ngoJi c>ch Xy # ph> c>ch. 'h! und!r+ying phi+osophy :tri@t +B c; sD= o" C is that th! programm!r, not th! +anguag!, is in charg! :chi phB=. 'h!r!"or! # do 8I, C )i++ +!t you do -irtua++y :<o ho>= anything that you )ant, !-!n :ngay c<= i" )hat you t!++ it to do is unorthodo. :phi chBnh thFng=, high+y unusua+ :rXt hi@m, 8~c (i3t=, or suspicious :g9y nghi ng%=. yo 8I, C sM cho phxp (Ln <o ho> (Xt cV thV g5 (Ln muFn, ngay c< thV (Ln nIi nI +Jm +J phi chBnh thFng, rXt hi@m or g9y nghi ng%. C gi-!s you n!ar+y comp+!t! :82y 8T, trSn -n, hoJn toJn= contro+ o-!r th! machin!. C cho phxp (Ln g2n nh6 8iHu khiRn toJn (E m>y. ]" cours!, )ith this po)!r com!s consid!ra(+! r!sponsi(i+ity, )hich you, th! programm!r, must shou+d!r. yr nhi1n, kh< nCngssVc mLnh nJy 8i km -7i mEt tr>ch nhi3m to +7n, mJ (Ln, -7i t6 c>ch +J 1 +4p tr5nh -i1n, ph<i g>nh ->c. s $!t som!(ody do som!thing A++o) som!(ody to do som!thing, $!t do som!thing A++o) doing som!thing s Und!rstanding th! ,!!d "or C++ # uiRu s& c2n thi@t cho C++ Gi-!n th! pr!c!ding discussion o" C, you might (! )ond!ring )hy C++ )as in-!nt!d. ,h6 8k nIi trong th<o +u4n tr67c -H C, (Ln cI thR ngLc nhi1n tLi sao C 86Pc ph>t minh. Uinc! C is a succ!ss"u+ and us!"u+ comput!r programming +anguag!, )hy )as th!r! a n!!d "or som!thing !+s! yo C +J 1 ngKn ngG +4p tr5nh thJnh cKng -J hGu dYng, -4y tLi sao ta c2n 1 thV g5 8I kh>c 'h! ans)!r is comp+!.ity. C9u tr< +%i kh> phVc tLp. 'hroughout th! history o" programming, th! incr!asing comp+!.ity o" programs has dri-!n th! n!!d "or (!tt!r )ays to manag! that comp+!.ity. 'rong suFt +\ch sw +4p tr5nh, s& tCng tBnh phVc tLp cTa ch6;ng tr5nh 8k dqn t7i s& c2n thi@t nhGng ph6;ng thVc tFt h;n 8R /u<n +B tBnh phVc tLp. C++ is a r!spons! to that n!!d. C++ +J

s& tr< +%i s 8>p Vng cho y1u c2u 8I. 'o (!tt!r und!rstand this corr!+ation :s& t6;ng /uan=, consid!r :.!m .xt= th! "o++o)ing. QR hiRu r_ h;n s& t6;ng /uan nJy, hky .!m .xt nhGng ph2n sau. Approach!s to programming ha-! chang!d dramatica++y sinc! th! in-!ntion o" th! comput!r. Gi<i ph>p s ph6;ng ph>p +4p tr5nh 8k thay 8Ni 8Et ngEt tg khi ph>t minh ra m>y tBnh. 'h! primary r!ason :+B do (an 82u= "or chang! has (!!n to accommodat! th! incr!asing comp+!.ity o" programs. $B do (an 82u cho s& thay 8Ni +J +Jm thBch nghi -7i nhGng ch6;ng tr5nh ngJy cJng phVc tLp. For !.amp+!, )h!n comput!rs )!r! "irst in-!nt!d :m7i 86Pc ph>t minh=, programming )as don! (y togg+ing in th! (inary machin! instructions :dWng +3nh nh\ ph9n= using th! comput!rs "ront pan!+. pB dY, khi m>y tBnh m7i 86Pc ph>t minh, -i3c +4p tr5nh d6Pc th&c hi3n (vng c>ch g_ thT cKng c>c dWng +3nh nh\ ph9n sw dYng (<ng 8iHu khiRn cI tr1n m>y tBnh. As +ong as programs )!r! Oust a "!) hundr!d instructions +ong, this approach )ork!d. mibn +J c>c ch6;ng tr5nh 8I cI -Ji trCm ch th\ th5 gi<i ph>p 8I 8k thJnh cKng. As programs gr!), ass!m(+y +anguag! )as in-!nt!d so that programm!rs cou+d d!a+ )ith +arg!r, incr!asing+y comp+!. :tBnh phVc tLp= programs (y using sym(o+ic r!pr!s!ntations o" th! machin! instructions. 0hi ch6;ng tr5nh ph>t triRn, ngKn ngG ass!m(+y 86Pc ph>t minh, n1n progamm!r cI thR gi<i /uy@t nhGng ch6;ng tr5nh +7n h;n -J phVc tLp h;n (vng c>ch ddng kB hi3u 8Li di3n cho ch th\ m>y. As programs continu!d to gro), high*+!-!+ +anguag!s )!r! d!-!+op!d to gi-! programm!rs mor! too+s )ith )hich to hand+! comp+!.ity. 0hi ch6;ng tr5nh ph>t triRn ti@p, ngKn ngG cXp cao 86Pc ph>t triRn cho +4p tr5nh -i1n nhiHu cKng cY h;n 8R .w +B tBnh phVc tLp. 'h! "irst )id!spr!ad :phN (i@n= +anguag! )as, o" cours!, F]z'zA,. ehi+! F]z'zA, )as a -!ry impr!ssi-! :Xn t6Png= "irst st!p, it is hard+y a +anguag! that !ncourag!s :tLo ra= c+!ar, !asy*to*und!rstand programs. m~c dd (an 82u F]z'zA, cI -c rXt Xn t6Png, nI rXt khI 8R cI thR +J mEt ngKn ngG mang +Li c>c ch6;ng tr5nh rJnh mLch, db hiRu. 'h! 1|0s ga-! (irth :cho ra 8%i= to structur!d programming. 'his is th! m!thod o" programming :ph6;ng ph>p +4p tr5nh= support!d :ht trP= (y +anguag!s such as C. eith structur!d +anguag!s, it )as, "or th! "irst tim!, possi(+! to )rit! mod!rat!+y :-ga ph<i= comp+!. programs "air+y !asi+y :kh> db=. p7i ngKn ngG cXu trAc, trong kho<ng th%i gian 82u ti1n, cI thR -i@t nhGng ch6;ng tr5nh cI 8E phVc tLp -ga ph<i kh> db. uo)!-!r, !-!n )ith structur!d programming m!thods, onc! a proO!ct :d& >n= r!ach!s :8Lt 86Pc= a c!rtain sil! :1 kBch c nJo 8I=, its comp+!.ity !.c!!ds :-6Pt /u>= )hat a programm!r can manag!. 'uy nhi1n, ngay c< -7i ph6;ng ph>p +4p tr5nh cXu trAc, 1 khi d& >n 8Lt 86Pc 1 kBch c nJo 8I, tBnh phVc tLp cTa nI -6Pt /u> nhGng g5 +4p tr5nh -i1n cI thR /u<n +B. By th! +at! 1|0s, many proO!cts )!r! n!ar or at this point. 'o so+-! this pro(+!m, a n!) )ay to program (!gan to !m!rg! :.uXt hi3n, nNi +1n=. 'his m!thod is ca++!d o(O!ct*ori!nt!d programming :+4p tr5nh h67ng 8Fi t6Png= :]] "or short=. Using ]] , a programm!r cou+d hand+! :.w +B= +arg!r programs. 'h! trou(+! )as that C did not support o(O!ct*ori!nt!d programming. 'h! d!sir! :67c muFn= "or an o(O!ct*ori!nt!d -!rsion o" C u+timat!+y :cuFi cdng= +!d to th! cr!ation o" C++. 7c muFn cho 1 phi1n (<n h67ng 8Fi t6Png cTa C cuFi cdng dqn 8@n s& tLo thJnh C++.

In th! "ina+ ana+ysis :s& ph9n tBch cuFi cdng=, a+though :m~c dd= C is on! o" th! most +ik!d and )id!+y us!d pro"!ssiona+ :chuy1n nghi3p= programming +anguag!s in th! )or+d, th!r! com!s a tim! )h!n its a(i+ity :kh< nCng= to hand+! :.w +B= comp+!.ity r!ach!s :8Lt t7i= its +imit. 'rong nh4n 8\nh cuFi cdng, m~c dd C +J 1 trong nhGng ngKn ngG +4p tr5nh chuy1n nghi3p 86Pc 6a thBch nhXt -J ddng rEng rki, 8k 8@n th%i 8iRm khi mJ kh< nCng .w +B tBnh phVc tLp cTa C 8Lt t7i gi7i hLn. 'h! purpos! :mYc 8Bch= o" C++ is to a++o) this (arri!r :ch67ng ngLi= to (! (rok!n and to h!+p th! programm!r compr!h!nd :hiRu, +rnh hEi= and manag! +arg!r, mor! comp+!. programs. mYc 8Bch cTa C++ +J 8R (c gky -4t c<n nJy -J giAp +4p tr5nh -i1n cI thR hiRu -J /u<n +B nhGng ch6;ng tr5nh +7n h;n, phVc tLp h;n. C++ Is Born In r!spons! :s& h6Dng Vng, 8>p +Li= to th! n!!d to manag! gr!at!r comp+!.ity, C++ )as (orn. QR 8>p +Li s& c2n thi@t ph<i /u<n +B tBnh phVc tLp +7n, C++ ra 8%i. It )as in-!nt!d :86Pc ph>t minh= (y BOarn! Utroustrup in 1|| at B!++ $a(oratori!s in murray ui++, ,!) Z!rs!y. u! initia++y :+Ac (an 82u= ca++!d th! n!) +anguag! C )ith C+ass!s. uo)!-!r, in 1|}3 th! nam! )as chang!d to C++. C++ contains th! !ntir! :hoJn toJn= C +anguag!. C++ chVa hoJn toJn nEi dung cTa ngKn ngG C. As stat!d !ar+i!r, C is th! "oundation upon )hich C++ is (ui+t. pJo +Ac (an 82u, C +J c; sD 8R C++ .9y d&a tr1n. C++ inc+ud!s a++ o" Cs "!atur!s :tBnh nCng=, attri(ut!s :kh< nCng=, and (!n!"its :+Pi Bch=. It a+so adh!r!s :trung thJnh -7i= to Cs phi+osophy :/uan 8iRm thi@t k@ cTa C= that th! programm!r, not th! +anguag!, is in charg! :8Vng 82u=. ,I cang trung thJnh -7i /uan 8iRm thi@t k@ cTa C, mJ phY thuEc -Jo +4p tr5nh -i1n ko ph<i ngKn ngG. At this point, it is critica+ to und!rstand that th! in-!ntion o" C++ )as not an att!mpt to cr!at! a n!) programming +anguag!. 8iRm nJy, -i3c /uan trSng +J ph<i hiRu rvng s& s>ng tLo ra C++ khKng ph<i +J nt +&c tLo ra mEt ngKn ngG +4p tr5nh m7i. Inst!ad :thay -Jo 8I=, it )as an !nhanc!m!nt :n9ng cao= to an a+r!ady high+y succ!ss"u+ +anguag!. 'hay -Jo 8I, 8I +J s& n9ng cao 1 ngKn ngG 8k rXt thJnh cKng. most o" th! additions that Utroustrup mad! to C )!r! d!sign!d to support o(O!ct* ori!nt!d programming. In !ss!nc! :-H (<n chXt=, C++ is th! o(O!ct*ori!nt!d -!rsion o" C. By (ui+ding upon th! "oundation o" C, Utroustrup pro-id!d a smooth migration path to ]] . Bvng c>ch .9y d&ng d&a tr1n c; sD C, Utroustrup cung cXp 1 con 86%ng di chuyRn tr;n :8;n gi<n= sang h67ng 8Fi t6Png. Inst!ad o" ha-ing to +!arn an !ntir!+y :hoJn toJn= n!) +anguag!, a C programm!r n!!d!d to +!arn on+y a "!) n!) "!atur!s to r!ap th! (!n!"its :h6Dng +Pi Bch= o" th! o(O!ct*ori!nt!d m!thodo+ogy :ph6;ng ph>p +u4n=. But C is not th! on+y +anguag! that in"+u!nc!d :<nh h6Dng 8@n= C++. Utroustrup stat!s :ph>t (iRu= that som! o" its o(O!ct*ori!nt!d "!atur!s )!r! inspir!d :+Xy c<m hVng= (y anoth!r o(O!ct*ori!nt!d +anguag! ca++!d Uimu+a. 'h!r!"or!, C++ r!pr!s!nts :8Li di3n cho= th! (+!nding :s& phFi hPp= o" t)o po)!r"u+ programming m!thods. yo 8I C++ 8Li di3n cho s& phFi hPp cTa { ph6;ng ph>p +4p tr5nh mLnh mM.

eh!n cr!ating C++, Utroustrup kn!) that it )as important to maintain :(<o -3, g5n giG= th! origina+ spirit o" C, inc+uding its !""ici!ncy, "+!.i(i+ity :tBnh +inh hoLt=, and phi+osophy :cXu trAc, /uan 8iRm=, )hi+! at th! sam! tim! adding support "or o(O!ct* ori!nt!d programming. uappi+y, his goa+ )as accomp+ish!d :hoJn tXt=. C++ sti++ pro-id!s th! programm!r )ith th! "r!!dom and contro+ o" C, coup+!d )ith th! po)!r o" o(O!cts. C++ -qn cung cXp cho programm!r -7i s& t& do 8iHu khiRn cTa C 8i km -7i sVc mLnh h67ng 8Fi t6Png. A+though C++ )as initia++y d!sign!d to aid :giAp 8= in th! manag!m!nt o" -!ry +arg! programs, it is in no )ay +imit!d to this us!. m~c dd C++ (an 82u 86Pc thi@t k@ 8R giAp 8 /u<n +B nhGng ch6;ng tr5nh rXt +7n, nh6ng nI ko gi7i hLn cho c>ch ddng nJy. In "act, th! o(O!ct*ori!nt!d attri(ut!s :tBnh chXt= o" C++ can (! !""!cti-!+y app+i!d to -irtua++y :<o hIa= any programming task. 'h4t -4y, tBnh chXt h67ng 8Fi t6Png cTa C++ cI thR 86Pc >p dYng hi3u /u< 8R <o hIa c>c nhi3m -Y +4p tr5nh. It is not uncommon to s!! C++ us!d "or proO!cts such as compi+!rs, !ditors, programm!r too+s, gam!s, and n!t)orking programs. C++ ko ch 86Pc ddng cho c>c d& >n nh6 tr5nh (i1n d\ch, cKng cY +4p tr5nh, gam!s -J ch6;ng tr5nh mLng. B!caus! C++ shar!s Cs !""ici!ncy, much high*p!r"ormanc! syst!ms so"t)ar! is construct!d using C++. BDi -5 C++ chia sc tBnh hi3u /u< cTa C, nhiHu ph2n mHm h3 thFng cI tBnh hi3u /u< 86Pc .9y d&ng (vng C++. A+so, C++ is "r!/u!nt+y th! +anguag! o" choic! "or eindo)s programming. Cang -4y, C++ +J ngKn ngG th6%ng 86Pc chSn cho +4p tr5nh eindo)s. ]n! important point to r!m!m(!r is this: B!caus! C++ is a sup!rs!t :t4p +7n= o" C, onc! you can program in C++, you can a+so program in C 'hus, you )i++ actua++y (! +!arning t)o programming +anguag!s at th! sam! tim!, )ith th! sam! !""ort :s& cF g?ng= that you )ou+d us! to +!arn on+y on!. yo -4y, (Ln sM th4t s& hSc 86Pc { ngKn ngG +4p tr5nh cdng +Ac, -7i cdng cKng sVc nh6 khi (Ln ch hSc 1 c>i. 'h! f-o+ution o" C++ * U& ph>t triRn cTa C++. Uinc! C++ )as "irst in-!nt!d, it has und!r gon! thr!! maOor r!-isions :s& .!m +Li=, )ith !ach r!-ision adding to and a+t!ring :thay 8Ni= th! +anguag!. 'g khi C++ ra 8Wi, nI 8k cI t7i 3 phi1n (<n chBnh, -7i mti phi1n (<n +Li th1m -J thay 8Ni ngKn ngG. 'h! "irst r!-ision )as in 1|} and th! s!cond occurr!d in 1||0. 'h! third r!-ision occurr!d during th! C++ standardilation proc!ss. $2n .!m .xt thV 3 dibn ra trong suFt ti@n tr5nh chuin hIa C++. In th! !ar+y 1||0s, )ork (!gan on a standard "or C++. pJo 82u nCm 1||0, 8k (?t cKng -i3c cho 1 chuin cTa C++. 'o)ards that !nd, a Ooint A,UI and IU] :Int!rnationa+ Utandards ]rganilation= standardilation committ!! )as "orm!d. Q@n cuFi, 1 Ty (an chuin hIa chung giGa A,UI -J IU] 86Pc h5nh thJnh. 'h! "irst dra"t :(<n ph>c th<o= o" th! propos!d standard :chuin 8H ngh\= )as cr!at!d on Zanuary {, 1||. In that dra"t, th! A,UIsIU] C++ committ!! :o" )hich I )as a m!m(!r= k!pt th! "!atur!s "irst d!"in!d (y Utroustrup and add!d som! n!) on!s as )!++. But, in g!n!ra+, this initia+ dra"t r!"+!ct!d th! stat! o" C++ at th! tim!. ,h6ng, -H c; (<n, (<n ph>c th<o (an 82u nJy 8k ph<n >nh t5nh trLng C++ +Ac 8I.

Uoon a"t!r th! comp+!tion o" th! "irst dra"t o" th! C++ standard, an !-!nt occurr!d that caus!d th! standard to !.pand gr!at+y: th! cr!ation o" th! Utandard '!mp+at! $i(rary :U'$= (y A+!.and!r Ut!pano-. U7m sau khi hoJn tXt (<n ph>c th<o 82u ti1n cTa C++, 1 s& ki3n .<y ra +Jm (<n chuin mD rEng 8>ng kR: s& ra 8%i th6 -i3n chuin cTa A+!.and!r Ut!pano-. As you )i++ +!arn, th! U'$ is a s!t o" g!n!ric routin!s that you can us! to manipu+at! :8iHu khiRn= data. 0hi (Ln hSc, th6 -i3n chuin +J t4p hPp c>c ch6;ng tr5nh con chung mJ (Ln cI thR ddng 8R 8iHu khiRn dG +i3u. It is (oth po)!r"u+ and !+!gant. ,I mang +Li hi3u /u< -J s& thanh nhk. But th! U'$ is a+so /uit! +arg!. Uu(s!/u!nt to th! "irst dra"t, th! committ!! -ot!d to inc+ud! th! U'$ in th! sp!ci"ication "or C++. 'i@p sau (<n ph>c th<o 82u ti1n, Ty (an thFng nhXt 86a km th6 -i3n chuin -Jo chuin cho C++. 'h! addition o" th! U'$ !.pand!d th! scop! :phLm -i= o" C++ )!++ (!yond :(1n cLnh, ngoJi ra= its origina+ d!"inition. U& (N sung th6 -i3n chuin mD rEng hi3u /u< cTa C++ (1n cLnh c>c 8\nh nghra (an 82u. ehi+! important, th! inc+usion o" th! U'$, among oth!r things, s+o)!d th! standardilation o" C++. U& (ao gnm th6 -i3n chuin, trong sF nhGng cF g?ng kh>c, +Jm ch4m ti@n tr5nh chuin hIa C++.

You might also like