}
cout<<\; cin >> x2 >> y2;
cout<<\; cout << distance( x1,y1,x2,y2 ) ;
double distance( double x1value ,double y1value ,double x2value,double y2value ) { return sqrt( pow( x1value - x2value ,2 ) + pow( y1value - y2value ,2 ) );
} 6.49
#include
int rollDice(); int Pointmake(); int main() { enum Status{ CONTINUE, WON, LOST }; int myPoint; Status gameStatus; int bankBalance = 1000; int wager;
cout << \ cin >> wager;
while( wager <= bankBalance ) {
srand( time( 0 ));
int sumOfDice = rollDice(); switch( sumOfDice ) { case 7: case 11: gameStatus = WON;
break;
case 2: case 3: case 12:
gameStatus = LOST;
; } }
}
break;
gameStatus = CONTINUE; myPoint = sumOfDice;
cout<<\< default: while( gameStatus == CONTINUE ) { } if( gameStatus == WON ) } else { } cout<<\< cout <<\< cout<<\< cout <<\< cout <<\< gameStatus = WON; if( sumOfDice ==7 ) gameStatus = LOST; else if ( bankBalance ==0 )cout<<\; int rollDice() { int sum = die1 +die2; cout<<\< } return sum; 6.50 #include const double PI = 3.1415926; inline double circleArea( double radius) { } int main() { } 6.51 #include int tripleByValue( int ); void tripleByReference( int & ); int main() { } int tripleByValue( int number) { return number *3; cout <<\ < cout << \; cin >> count; double R; cout <<\; cin >> R; cout << \< } void tripleByReference( int &numberRef ) { numberRef= numberRef *3; } 6.53 #include int main( ) { int int1,int2; cout << \; cin >> int1 >>int2; cout << \< cout << \; cin >> double1 >>double2; cout << \< char char1,char2; cout << \; cin >> char1 >>char2; cout << \< template T minimum( T value1, T value2 ) { T minimunValue = ( value1 < value2 ) ? value1 :value2 ; return minimunValue; } 6.54 #include int main( ) { int int1,int2; } cout << \; cin >> int1 >>int2; cout << \< cout << \; cin >> double1 >>double2; cout << \< char char1,char2; cout << \; cin >> char1 >>char2; cout << \< 头文件 template T maximum( T value1, T value2 ) { } 6.56 #include void NewQuestion(int&,int&); //int Resultvalue( ); int main( ) { int num1; cout << setw( 10 ) <<\< NewQuestion(num1,num2); cin>> Result; while ( Result != num1* num2 ) cout << \< int num2; T maximumValue = ( value1 > value2 ) ? value1 :value2 ; return maximumValue; loop:
C++大学教程习题解答(第七版)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)