A s2a nn s1b200 cout s1b s1b

Info iconThis 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: Complex(int r, int i) { real=r; image=i; } void CopyComplex(Complex des, Complex src) { des=src; } void main() { Complex x(10, 20); Complex y(30, 40); cout<<" x => " ; x.ShowComplex(); cout<<" y => " ; y.ShowComplex(); cout<<"-------------------------------- \n" ; CopyComplex(y, x); cout<<" x => " ; x.ShowComplex(); cout<<" y => " ; y.ShowComplex(); } - 20 - IT COOKBOOK [실습하기 9-5] 결과값이 객체인 함수 작성하기 [예제 9-5] 9_5.cpp //-------------------[예제 9-4]와 중복된 내용 생략----------------------29 Complex CopyComplex(Complex des, Complex src) 30 { 31 des=src; 32 return des; 33 } 34 void main() 35 { 36 Complex x(10, 20); 37 Complex y(30, 40); 38 39 cout<<" x => " ; 40 x.ShowComplex(); 41 cout<<" y => " ; 42 y.ShowComplex(); 43 44 cout<<"-------------------------------- \n" ; 45 y=CopyComplex(y, x); 46 cout<<" x => " ; 47 x.ShowComplex(); 48 cout<<" y => " ; 49 y.ShowComplex(); 50 } - 21 - IT COOKBOOK [실습하기 9-6] 객체의 주소에 의한 전달 방식의 함수 작성하기 [예제 9-6] 9_6.cpp //-----------------------중복된 내용 생략----------------------29 void CopyComplex(Complex *pDes, Complex src) 30 { 31 *pDes=src; 32 } 33 void main() 34 { 35 Complex x(10, 20); 36 Complex y(30, 40); 37 38 cout<<&quo...
View Full Document

Ask a homework question - tutors are online