Briefly explain what is wrong (exactly 1 error) with the following code. int num_cmb = rand() % 6; // # of combinations int num_pmt = ( num_cmb + 1 ) % 10; // # of permutations cout << num_num_cmb; cout << num_num_pmt; double num_arng, num_drng; // # of arrangements, derangements num_arng = 2.0 / ( 1 + num_cmb - ( 1 + num_cmb ) ); num_drng = 1.5 * num_pmt; cout << num_arng; cout << num_drng;
//C++ Solution
int num_cmb = rand() % 6; // # of combinations
int num_pmt = ( num_cmb + 1 ) % 10; // # of
permutations
cout << num_num_cmb;/*ERROR=> num_num_cmb was not defined. it
should be num_cmb*/
cout << num_num_pmt;/*ERROR=> num_num_pmt was not defined. It
should be num_pmt */
double num_arng, num_drng; // # of arrangements,
derangements
num_arng = 2.0 / ( 1 + num_cmb - ( 1 + num_cmb )
);
num_drng = 1.5 * num_pmt;
cout << num_arng;
cout << num_drng;
//If you need any help regarding this solution....... please leave a comment...... thanks
Get Answers For Free
Most questions answered within 1 hours.