C++.., C# Java C++., C++. C++,. C++.,,.. C++. C++,,., C++.. C++,,, C++..,. C++ C++. C++.
24?. 12, C++.... A..... /...
25.,.,. Java C#., C++., Java C#, C++., Microsoft Visual C++ Borland C++ Builder C++. : www.osborne.com www.infopub.co.kr. C++.. C++,. C + + 2 1 (, 8 9-8 054-4 84-7) C+ + (, 8 9-8 054-4 29-4 ) (Effect ive ) STL(, 89-80 54-4 5 9-6 ) STL (, 8 9-8 054-4 69-3)
26 Java,. J ava 2 2 1 (, 8 9-8 054-3 80-8) J ava (, 89-80 54-4 8 1-2 ) J av a (, 89-80 54-4 2 2-7 ) C#,. C# (, 89-80 54-4 6 1-8 ) C#.NET (, 8 9-8 054-4 74- X) C# 2 nd Ed it io n (, 89-80 54-4 6 3-4 ), Schildt. Windows 98 Programming From the Ground Up Windows 2000 Programming From the Ground Up MFC Programming From the Ground Up The Windows Programming Annotated Archives C,. C 2 1, Herbert Schildt.
1 C++ C+ + C+ + C, C#, J a v a C+ + if for C+ +
28 C++ C++.. C++,. C++ Java C#., C++.. C++, C++.,. C++. C++, C++., C++. C++ C++ C. C++ C., C++ C. C++ C ( ). C++ C., C++ C., C++, C. C : C... C.
Module 1 : C++ 29 C Dennis Ritchie, UNIX DEC PDP-11. C BCPL. BCPL Martin Richards. BCPL 1970 C Ken Thompson B. C., C.,,. C,,., C,. C 1960 (structured programming).,,,.,.. Pascal, C,. C ( )., C., C 1980. C++, C++. C,? (complexity).,,
30 C++.,..,,...,., FORTRAN. FORTRAN,. 1960 C..,,. 1970., (OOP : Obj ect Oriented Programming).,. C. C C++., C, C.,. C++.
Module 1 : C++ 3 1 C++ C++ 1979 New Jersey, Murray Hill Bjarne Stroustrup. C., 1983 C++. Stroustrup C C C++. C., Stroustrup.,. Stroustrup C. C++ C. C, Stroustrup. C. C++, Stroustrup C,,.. C++ C. C++, C., C++. C++,,,,. C++ C, C++., C++.
32 C++ C++ C++,. 1985, 1990. C++., C++., ANSI(American National Standards Institute) ISO(International Standards Organization). 1994 1. ANSI/ISO C++ ( ) Stroustrup,. C++. C++,. Alexander Stepanov (Standard Template Library : STL). STL..., C++ STL. STL C++. STL C++. C++.,., ANSI/ISO C++ Stroustrup. 1997 11 14, C++ ANSI/ISO 1998. C++ C++. C++. Microsoft Visual C++ Borland C++ Builder C++ C++..
Module 1 : C++ 33 C++ C#, 2, C#. Sun Microsystems, C# Microsoft. C++,. C++ C#. C#,,,., C++ C#.,,. C++, C#.. C#, C++. C# C++., C++. C++, C#. C++ CPU., Intel Pentium, C++. C# (, C# ). CPU.,,....,, C++. C#.,, C++., C#.
34 C++ C++, C#.,. C+ +? C+ +? C+ + C#.?? 1 C++ (OOP)., OOP C++., C++ OOP...., ( ) ( ).,.. C+ + C. C+ +..
Module 1 : C++ 35 C#? C+ +?, C#, C++. C++, CPU. CPU. C++,. C++. C#,.,. C#, Mic rosoft Inte rmediate Language (MSIL).,., Java Virtual Machine(JVM). C# Common Language Runtime(CLR)., JVM,. C# CLR,. C# CPU, C++. C++ C#..,..,., C++ OOP,,..
36 C++,....,., private, public. private., private. public,,., public private. C++... C++..,..,.. C++..?,.. C++. C#., C++.
Module 1 : C++ 37 ( ).. ( ).,,, -.,..., ( )..,,.,,.,. C++.,.,,..,. ( )....., (, ).,,,
38 C++., (, ),., (, ). (, ).,.,.,..,. OOP? C+ +? C+ +? 2 (OOP )., OOP. C+ +,?. C++,. C++ / C#. / C#,. C++., C++,.,, OOP. C+ +. C+ +.
Module 1 : C++ 39. C++. / * C++. Sample. cpp. */ #i nclude <i ost ream> usi ng namespace st d; / / C++ mani (). i nt mai n() { cout << "C++ i s power pr ogrammi ng. "; } ret urn 0;. 1.. 2.. 3..,....
40 C++ Osborne www.osborne.com.,..,. text,. C++.,.., C++.cpp. C++,.cpp. Sample.cpp.. Sample.cpp., Microsoft Visual C++ Borland C++ builder (IDE) ( ). C++.., Visual C++ C++ builder,., Visual C++ Sample.cpp,. C: \... >c l - GX Sample. cpp
Module 1 : C++ 4 1 -GX. Visual C++ VCVARS32.BAT. Visual C++ (, Visual Studio.NET Microsoft Visual Studio. NET Visual Studio.NET, ). C++ builder Sample.cpp,. C: \... >bcc32 Sample. cpp C++.,,.exe. Sample.cpp Sample.exe. C++,. C++,., Sample.exe. C: \... >Sample. C++ i s power programmi ng.,...
42 C++,.,. C++., C++., (GUI).. 50 70. C++.,., C++. Sample.cpp, C++.. / * C++. */ Sample. cpp.., C++....,.,. C++.. /* ( ) */.
Module 1 : C++ 43.,... #i nclude <i ost ream> C++,. <iostream>, C++..,.. usi ng namespace st d; std. C++..... std. C++. std (,., C ).. / / C++ mai n().
44 C++ C++. //., C++,,,.,.,. i nt mai n() C++.,. C++, C++ main(). main(), ( ) (, C++ main(), main() ). main() main(). main() int main()., C++, int... cout << "C++ i s power progr ammi ng. ";. C++ is power programming. <<. <<,. cout,.,.., C++.
Module 1 : C++ 45 C++ is power programming.. C++. C++.. ret urn 0; main(), ( ) 0. 0.. return C++,. ( ) 0. ( } ).,,,.,.,. C++.,.,, main(), cout.,.
46 C++ 3C+ +? cout? #include <iostream>?.,?, C++.,,....,. C++,. ( ).,.,.. C+ + main (). cout. <iostream>.
Module 1 : C++ 4 7.,.,.,. length 7, The length is 7. / /. #i nclude <i ost ream> usi ng namespace st d; i nt mai n() { i nt lengt h;. / /. lengt h = 7; / / lengt h 7. length. cout << "The lengt h i s "; cout << lengt h; / / 7. length. } ret urn 0;, C++.,,., VarDemo.cpp.., i nt lengt h; / /.
48 C++ length. C++,.,. (type)., length. -32,768 32,767. C++ int. C++ ( ).. lengt h = 7; / / lengt h 7., length 7. C++.., length 7. length. cout << lengt h; / / 7., cout <<. length 7,., length., C++..
Module 1 : C++ 49 + - * / C++., (*). / / #i nclude <i ost ream> usi ng namespace st d; i nt mai n() { i nt lengt h; i nt widt h; i nt area; / /. / /. / /. lengt h = 7; / / lengt h 7. widt h = 5; / / widt h 5. area = lengt h * wi dt h; / / length width area. cout << "The area i s "; cout << area; / / 35. } ret urn 0; length, width area. length 7, width 5. area.
50 C++. The area i s 35, area.,. / / area #i nclude <i ost ream> usi ng namespace st d; i nt mai n() { i nt lengt h; i nt widt h; / / / / lengt h = 7; wi dt h = 5; / / lengt h 7 / / widt h 5 } cout << "The area i s "; cout << lengt h * widt h; ret urn 0; / / 35. length * width., length width, cout... C++ 2.,., length, width area.
Module 1 : C++ 5 1 i nt lengt h, widt h, area; / /. 2 C++. 4? min 0.?., 7 5,.,,,. >>. C++.,. ci n >> var;, cin. C++. cin,. var.. C+ +. min = 0;. 2.
52 C++. / * */ #i nclude <i ost ream> usi ng namespace st d; i nt mai n() { i nt lengt h; i nt widt h; / /. / /. cout << "Ent er t he lengt h: "; ci n >> lengt h; / /. cout << "Ent er t he widt h: "; ci n >> wi dt h; / /. length. width. cout << "The area i s "; cout << lengt h * widt h; / /. } ret urn 0;. Ent er t he lengt h: 8 Ent er t he wi dt h: 3 The area i s 24
Module 1 : C++ 53. cout << "Ent er t he lengt h: "; ci n >> lengt h; / /. cout. cin, length., ( ) >> ( length)., cin, length ( length 0 ).. cout., cout.., cout.,. cout << "The area i s "; cout << lengt h * wi dt h; / / 35.. cout << "The area i s " << lengt h * wi dt h; cout., The area is.,. <<.
54 C++, -.,. C++ -. \n( n). \n. / * \ n. */ #i nclude <i ost ream> usi ng namespace st d; i nt mai n() { cout << "one\ n"; cout << "t wo\ n"; cout << "t hree"; cout << "four "; } ret urn 0;. one t wo t hreef our..
Module 1 : C++ 55 5C+ +? cin? \ n? int., int.,., int 18, 18.3., int C++. C++ f loat double. double. double. double resul t ; result double. result, 88.56, 0.034, -107.03. int double. / * i nt double. >>. cin. \ n.
56 C++ */ #i nclude <i ost ream> usi ng namespace st d; i nt mai n() { i nt i var; double dvar ; / / i nt. / /. ivar = 100; / / i var 100. dvar = 100. 0; / / dvar 100. 0. cout << "Or i gi na l value of i var : " << i var << "\ n"; cout << "Or i gi na l value of dvar : " << dvar << "\ n"; cout << "\ n"; / /. / / 3. ivar = ivar / 3; dvar = dvar / 3. 0;. cout << "ivar af t er di vi si on: " << ivar << "\ n"; cout << "dvar af t er di vi si on: " << dvar << "\ n"; } ret urn 0;. Or i gi na l va lue of i var : 100 Or i gi na l va lue of dvar : 100 ivar af t er divi s i on: 33 dvar af t er divi s i on: 33. 3333
Module 1 : C++ 57, ivar 3,, 33., dvar 3,.. cout << "\ n"; / /... C+ +?,? C++.,.,, float double.,., C++., (, ). C++. 1-1 : (Feet) (Meter) Ft om.cpp C+ +. C+ +
58 C++... 1 3.28.., double.,. Step-by-Step 1. FtoM.cpp C+ + (C+ +. ). 2., <iostream>, st d. / * 1-1. */ Ft om. cpp. #i nclude <i ost ream> usi ng namespace st d; 3. f m main (). i nt mai n() { double f ; double m; / /. / /. 4.. cout << "Ent er t he lengt h i n f eet : "; ci n >> f ; / /.
Module 1 : C++ 59 5.. m=f / 3.28; / /. cout << f << " f eet i s " << m<< " met er s. "; 6.. ret urn 0; } 7.. / * 1-1 */. Ft om. cpp. #i nc lude <i ost ream> usi ng namespace st d; i nt mai n() { double f ; double m; / /. / /. cout << "Ent er t he lengt h i n f eet : "; ci n >> f ; / /. m =f / 3.28; / /. cout << f << " f eet i s " << m<< " met er s. "; } ret urn 0;
60 C++ 8... Ent er t he lengt h i n f eet : 5 5 feet i s 1. 52439 met er s. 9..,. 6 C+ +? double??,. C++.,. if C++ if. C++ if if., C Java, C#. if. int. double. \ n.
Module 1 : C++ 6 1 i f (condi t i on) st at ement ; condition. C++, 0, 0.,., 10 is less than 11., 10 11. i f (10 < 11) cout << "10 i s less t han 11";, i f (10 > 11) cout << "t hi s does not di splay"; 10 11 cout., if,. C++ (conditional expression).. < <= > >= = =!=.
62 C++ if. / / i f. #i nclude <i ost ream> usi ng namespace st d; i nt mai n() { i nt a, b, c; a =2; b =3; i f (a < b) cout << "a i s less t han b\ n"; if / /. i f (a == b) cout << "you won' t see t hi s\ n"; cout << "\ n"; c =a - b; / / c - 1. cout << "c cont ai ns - 1\ n"; i f (c >= 0) cout << "c i s non- negat i ve\ n"; i f (c < 0) cout << "c i s negat ive\ n"; cout << "\ n"; c =b - a; / / c 1. cout << "c cont ai ns 1\ n"; i f (c >= 0) cout << "c i s non- negat i ve\ n"; i f (c < 0) cout << "c i s negat ive\ n"; } ret urn 0;
Module 1 : C++ 63. a i s less t han b c cont ai ns - 1 c i s negat i ve c cont ai ns 1 c i s non- negat i ve for. C++. f or. C# Java, C++ for. for. for (i ni t i al i zat i on; condi t i on; i ncrement ) st at ement ; initialization. condition. condition (0 ). increment. for, 1 100. / / f or #i nclude <i ost ream> usi ng namespace st d; i nt mai n()
64 C++ { i nt count ; for. for (count =1; count <= 100; count =count +1) cout << count << " "; } ret urn 0;, count 1.. count <= 100, count 1. count 100,,. C++. count =count +1, C++. ++ ( ). ++ 1., for. for (count =1; count <= 100; count ++) cout << count << " ";.
Module 1 : C++ 65 C++ --. 1. 7if? for? C+ +? C++ (code block)...,., if for. if. i f (w <h) { v = w * h; w = 0; } w h,.,,.,.. if C+ +. for C+ +. = =,!=, <, >, <=, >=.
66 C++ 0. / /. #i nclude <i ost ream> usi ng namespace st d; i nt mai n() { double resul t, n, d; cout << "Ent er va lue: "; ci n >> n; cout << "Ent er di vi sor : "; ci n >> d; / / i f. i f (d!= 0) { cout << "d does not equal zero so di vi si on i s OK" << "\ n"; result =n / d; cout << n <<"/ "<<d <<"i s "<<resul t ; } } ret urn 0; if.. Ent er value : 10 Ent er di vi sor : 2 d does not equa l zero so divi s i on i s OK 10 / 2 i s 5
Module 1 : C++ 67, if. if ( ) 3. 0.,.?, { }?...,.. C++,,.,..,.,. C++,.,., C++ x = y; y = y +1; cout << x << "" << y;
68 C++. x = y; y = y + 1; cout << x << "" << y;,.,. cout << "Thi s i s a long l i ne. The sum i s : " << a + b + c + d + e + f ;.,.. C++,.,.,.... 8?? C+ +,. C+ +.? { }...
Module 1 : C++ 69 FtoMTable. cpp 1-2 : - for, if,. 1 100. 10,. counter. counter. Step-by-Step 1. FtoMTable.cpp. 2.. / * */ 1-2 -. Ft omtable. cpp. #i nc lude <i ost ream> usi ng namespace st d; i nt mai n() { double f ; double m; i nt count er; / /. / /. count er = 0; 0. for (f = 1.0; f <= 100. 0; f ++) { m =f / 3. 28; / /. cout << f << " feet i s " << m<< " met ers. \ n"; count er++; / / 10. 1.
70 C++ } i f (count er == 10) { } cout << "\ n"; / /. count er = 0; / /. counter 10,. } ret urn 0; 3. 10 counter. counter for 0, 1. counter 10,, counter 0.. 4.... 1 feet i s 0.304878 met ers. 2 feet i s 0.609756 met ers. 3 feet i s 0.914634 met ers. 4 feet i s 1.21951 met er s. 5 feet i s 1. 52439 met er s. 6 feet i s 1.82927 met er s. 7 feet i s 2. 13415 met er s. 8 feet i s 2.43902 met er s. 9 feet i s 2.7439 met ers. 10 f eet i s 3. 04878 met ers. 11 f eet i s 3. 35366 met ers. 12 f eet i s 3. 65854 met ers. 13 f eet i s 3. 96341 met ers. 14 f eet i s 4. 26829 met ers. 15 f eet i s 4. 57317 met ers. 16 f eet i s 4. 87805 met ers. 17 f eet i s 5. 18293 met ers. 18 f eet i s 5. 4878 met er s.
Module 1 : C++ 7 1 19 feet i s 5. 79268 met er s. 20 feet i s 6. 09756 met er s. 21 feet i s 6. 40244 met er s. 22 feet i s 6. 70732 met er s. 23 feet i s 7. 0122 met ers. 24 feet i s 7. 31707 met er s. 25 feet i s 7. 62195 met er s. 26 feet i s 7. 92683 met er s. 27 feet i s 8. 23171 met er s. 28 feet i s 8. 53659 met er s. 29 feet i s 8. 84146 met er s. 30 feet i s 9. 14634 met er s. 31 feet i s 9. 45122 met er s. 32 feet i s 9. 7561 met ers. 33 feet i s 10.061 met ers. 34 feet i s 10.3659 met er s. 35 feet i s 10.6707 met er s. 36 feet i s 10.9756 met er s. 37 feet i s 11.2805 met er s. 38 feet i s 11. 5854 met er s. 39 feet i s 11.8902 met er s. 40 feet i s 12. 1951 met er s. 5. 25. C++. 5,., C++.
72 C++,.,., MyFunc. MyFunc. MyFunc () ;,..,.,..,.., MyFunc(), MyFunc() 2. MyFunc (2);,......., MyFunc(), MyFunc. x = MyFunc (2);., MyFunc(). MyFunc() x.,.
Module 1 : C++ 73, x = MyFunc(2) + 10;, MyFunc() 10. x.,,,..... C++ abs(). abs(),. / / abs (). #i nclude <i ost ream> #i nc lude <cst dl i b> usi ng namespace st d; i nt mai n() { i nt resul t ; resul t = abs (- 10) ; abs (), result. cout << resul t ; } ret urn 0;
74 C++ -10 abs(), abs(). 10. result, 10.. <cstdlib> abs()..,., main().., C++.. abs().., C++.., getval getval().. C++, abs() C++. (standard library).. C++.,,., C++.
Module 1 : C++ 75 C++,....,., C++ (class library).,. 9?.? C+ +? C++ C++ 63. [ 1.1]. C++, C++., C++ overload,. C++,. C++,.. C+ +.. C+ + C+ +.
76 C++.,,. line_count. 1.1 C+ + asm auto bool break case catch char class const const_cast cont inue default delete do double dynamic_cast else enum explicit export extern false float for f riend goto if inline int long mutable names pace new operator private protected public register reinterpret_cast return s hort s igned s izeof stat ic stat ic_cast st ruct switch template this t hrow true try typedef typeid typename union unsigned us ing virtual void volatile wchar_t while., C++, myvar MyVar., C++., cout.. Test x y2 MaxIncr up _top my_var s impleinterest23
Module 1 : C++ 77. 980K.. 10for, For, FOR? C+ +? index21 Index21? for. C+ +. C+ +,,.. C+ +.
78 C++ 1. C++.. 2. C++.?? 3.? 4. C++? 5.? 6. <iostream>?? #include <iostream> 7.? 8.? 9.? a. count b. _count c. count27 d. 67count e. if 10.?? 11. if. for. 12.? 13. 17%.. 1 100. 25. - -
Module 1 : C++ 79 14. 1 ( ) 12.... 15.? 16. 5.