【正文】
{ char c=a。 b=c。 *a=b。 } void sub( char* a,char* b ) { char c=*a。 *b=c。A39。B39。a,amp。 coutabendl。 } (Key: BA) 下列程序輸出的結(jié)果是 _____。 void Exchange( int* pFirst,int* pLast ) { if( pFirstpLast ) { int Change = *pFirst。 *pLast = Change。 } } void Print( int Integer[],int HowMany) { for( int Index=0。 Index++ ) coutInteger[Index] 。 } int _tmain() { int Integer[] = {1,2,3,4}。Integer[0],amp。 Print(Integer,4)。 } (Key: 4 3 2 1) 下列程序輸出的結(jié)果是 _____。 int _tmain() { int nInteger = 5, amp。 rInteger = nInteger+1。 return 0。 (構(gòu)造函數(shù) ) 下列程序輸出的結(jié)果是 _____。 int _tmain() { int x=2,y=3,z=4。amp。 return 0。 int _tmain() { int x=1,y=2,z=3。 cout(xy?y:x),。 coutyendl。 } Key: 6,5,6 include iostream using namespace std。 class CSample { int i。 ~CSample(void)。 void Print(void)。 CSample::CSample(void) { coutConstructor1endl。 } CSample::CSample(int val) { coutConstructor2endl。 } void CSample::Print(void) { couti=iendl。 } int _tmain() { CSample a,b(10)。 ()。 } Key: Constructor1 Constructor2 i=0 i=10 Destructor Destructor include iostream using namespace std。 public: CData( int Integer )。 void Print(void)。 CData::CData( int Integer ) : nInteger(Integer) { coutConstructing a dataendl。 } void CData::Print(void) { coutThe data is nIntegerendl。 public: CNumber(int Integer,double Number)。 void Print(void)。 CNumber::CNumber( int Integer,double Number ) : CData( Integer ) , fNumber(Number) { coutConstructing a numberendl。 } void CNumber::Print(void) { CData::Print()。 } int _tmain() { CNumber Number(1,)。 return 0。 include iostream using namespace std; int _tmain() { long Term=________________ ,Sum=________________; for( int Index=1; Index=________________; Index++) { Term *=________________; Sum +=________________; } coutSum of factorial from 1 to 10 is ; coutSumendl; return 0; } Key:1 0 10 Index Term 完成下面程序,計算三角形和正方形的面積。 include iostream using namespace std; class CShape { public: CSquare::CSquare(double Width,double Height) :____________________________________ } double CSquare::Area(void) { ____________________________________; } int _tmain() { CTriangle Triangle(16,8); coutThe area of triangle is ()endl; CSquare Square(13,8); coutThe area of square is ()endl; return 0; } Key: fWidth(Width) CShape(Width,Height) return fWidth*fHeight/2 CShape(Width,Height) return fWidth*fHeight 五、用面向?qū)ο蠓椒ㄔO(shè)計一個階乘類 CFactorial,在 CFactorial 類的構(gòu)造函數(shù) CFactorial(long Integer)中 ,將 Integer 的值賦給 nInteger;在主函數(shù) int _tmain(),鍵盤輸入任一整數(shù) Integer,以 Integer 的值為實(shí)際參數(shù)構(gòu)造一個階乘對象 Factorial,調(diào)用對象 Factorial 的相應(yīng)成員函數(shù)輸出 nInteger 的階乘值fFactorial。若 nInteger 沒有階乘值,則 fFactorial 賦值為 0。若 nInteger沒有階乘,則輸出 nInteger 沒有階乘的信息。s 10 mustsee animations】 The Chinese animation industry has seen considerable growth in the last several years. It went through a golden age in the late 1970s and 1980s when successively brilliant animation wor