好文档 - 专业文书写作范文服务资料分享网站

C++大学教程习题解答(第七版) 

天下 分享 时间: 加入收藏 我要投稿 点赞

#include using namespace std;

double min( double, double, double);

int main() { }

double min( double x, double y, double z ) { }

double T; T=x < y? x : y ; return T < z ?T:z; double x,y,z;

cout << \; cin >> x >> y >> z;

cout <<\<

6.28

#include #include using namespace std; int isperfect( int );

int main() { }

int isperfect( int number ) {

int sum = 0; int counter1;

for( counter1 = 1; counter1 < number ; counter1++ )

if ( number % counter1 == 0 )

sum += counter1;

cout << \<

for( int counter = 1; counter <= 1000; counter++ ) }

{

if( isperfect( counter ) == counter ) cout<< isperfect( counter )<

return sum ;

}

6.29

#include #include #include

using namespace std; bool isprime( int );

int main() { }

bool isprime( int number ) { } 6.30

#include #include #include

if ( number == 1 )

return false; return true;

if ( number % counter == 0 )

return false;

if ( number == 2 )

for ( int counter = 2 ; counter < number ; counter++ )

cout << \<

{

if( isprime( counter1 )==true ) {

cout << setw(5)<

if ( i ==0 ) }

cout<

return true;

using namespace std; void ReseredOrder( int );

int main() { }

void ReseredOrder( int number ) { } 6.31

#include #include #include

using namespace std; int gcd( int,int );

int main() { }

//int gcd( int number1,int number2 ) //{

// int Mod;

// if( number2 > number1 ) // {

int x,y;

cout << \<> x >>y; gcd( x,y );

cout << \<

cout << number; number = number / 10; int num;

cout << \<> num;

ReseredOrder( num );

}while( number !=0 );

// Mod = number1; // number1 = number2; // number2 = Mod; // } // do{ // //

Mod = number1 % number2; number1 = number2;

// number2 = Mod; // }while( Mod != 0 ); // return number1; //}

int gcd(int number1, int number2) {

if(number2 == 0) return number1;

else return gcd(number2, number1%number2); } 6.32

#include #include #include

using namespace std;

int qualityPoints( double );

int main() { }

int qualityPoints( double number ) {

if( ( number>=90 )&&( number <=100 ))

return 4; else

if( ( number>=80 )&&( number <90 )) return 3; else

if( ( number>=70 )&&( number <80 )) double x;

cout << \<> x ;

cout << \<

}

return 2;

if( ( number>=60 )&&( number <70 )) return 1; return 0;

else

else

6.33

#include #include #include

using namespace std; void flip();

int number1=0, number2=0; int main() { } }

void flip( ) {

int face = 0 +rand( ) % 2; if( face ==0 ) { }

if( face ==1 ) { }

cout<

cout<

number1++;

cout << \<< number1 << endl; cout << \<< number2 << endl; cout << \<

for( int counter = 1;counter <= 100; counter++ ) {

flip();

if( counter % 10 ==0 )

cout<

C++大学教程习题解答(第七版) 

#includeusingnamespacestd;doublemin(double,double,double);intmain(){}doublemin(doublex,doubley,doublez){}doubleT;T=x
推荐度:
点击下载文档文档为doc格式
8lwww86r4o862m61dk4v721et5ixox005np
领取福利

微信扫码领取福利

微信扫码分享