1、 hours1 hours2 hours3; fixed setprecision( 2 );Car setw( 20 ) Hours Charge endl;1 hours1 calculateCharges( hours1 )endl;2 hours2 calculateCharges( hours2 )3 hours3 calculateCharges( hours3 )TOTAL setw( 16 ) hours1 + hours2 + hours3 setw( 20 ) calculateCharges( hours1 ) + calculateCharges( hours2 ) +
2、 calculateCharges( hours3 ) 0 ) & ( hours 3 )&= 19 ) ) return 2.00+ceil( hours - 3 )*0.5; return 10;6.14double roundToInteger( double );double roundToTenths( double );double roundToHundredths( double );double roundToThousandths( double ); double x; Please Input the number: x;roundToInteger : roundTo
3、Integer( x ) roundToTenths : roundToTenths( x ) roundToHundredths : roundToHundredths( x ) roundToThousandths : roundToThousandths( x ) cstdlib srand( time( 0 ) ); int x; x= 1 + rand( ) % 1; coutx = x x= 1 + rand( ) % 100;x= x= 0 + rand( ) % 9; x= 1000 + rand( ) % 112; x= -1 + rand( ) % 2; x= -3 + r
4、and( ) % 15;6.17int main()int array1 = 2, 4, 6, 8, 10 ;int array2 = 3, 5, 7, 9, 11 ;int array3 = 6, 10, 14, 18, 22 ;srand( time( 0 ) );for (int i = 0; i 3; i+)cout第i+1次?随?机结果?:t第一组数y据Y中D的y:array1rand() % 5二t组array2rand() % 5三y组array3rand() % 5endlreturn(0);6.18int integerPower( int, int ); int x,y;P
5、lease input the base:plesae input the exponent: y;integerPower( , y ) = integerPower( x ,y );int integerPower( int base, int exponent ) int value1 = 1; for( int counter = 1;counter = exponent ; counter+ ) value1 *= base; return value1;6.19double hypotenuse( double, double ); double x,y;Please input
6、the side1:plesae input the side2:hypotenuse = setprecision(2)boolalphamultiple( x, y )/ if( multiple( x,y )=1 )/ cout truen / else falsen goto loop;bool multiple( double number1, double number2 ) if( ceil( number2 / number1 ) = floor( number2 / number1 ) return true; return false;6.21bool iseven( int );Please input the integer number: x ;iseven( x )bool iseven( int number) if( number % 2 =0 )6.22void printSar( int ); printSar( x ); return 0;void printSar( int number) f
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1