{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Showcomplex cout y yshowcomplex cout

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: [예제 9-2] 9_2.cpp 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 Complex::Complex(int real, int image) { this->real=real; this->image=image; } void Complex::ShowComplex() const { cout<<"( "<< this->real <<" + "<< this->image <<"i )"<<endl ; } void main() { Complex x(10,20); x.ShowComplex(); } - 16 - IT COOKBOOK [실습하기 9-3] 객체 단위로 값 치환하기 [예제 9-3] 9_3.cpp 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #include<iostream> using namespace std; class Complex { private : int real; int image; public : Complex( int r=0, int i=0); void ShowComplex() const; void SetComplex(int r=0, int i=0); }; Complex::Complex(int r, int i) { real=r; image=i; } void Complex::ShowComplex() const { cout<<"( " <<real <<" + " <<image << "i )" <<endl ; } - 17 - IT COOKBOOK [실습하기 9-3] 객체 단위로 값 치환하기 [예제 9-3] 9_3.cpp 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 void Complex::SetComplex(int r, int i) { real=r; image=i; } void main() { Complex x(10,20); Complex y; cout<<" x => " ; x.ShowComplex(); cout<<" y => "...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern