More Pointer Exercises
8.20 |
Modify the card shuffling and dealing program of Figs. 8.258.27 so the shuffling and dealing operations are performed by the same function (shuffleAndDeal). The function should contain one nested looping statement that is similar to function shuffle in Fig. 8.26. |
8.21 |
What does this program do? 1 // Ex. 8.21: ex08_21.cpp 2 // What does this program do? 3 #include 4 using std::cout; 5 using std::cin; 6 using std::endl; 7 8 void mystery1( char *, const char * ); // prototype 9 10 int main() 11 { 12 char string1[ 80 ]; 13 char string2[ 80 ]; 14 15 cout << "Enter two strings: "; 16 cin >> string1 >> string2; 17 mystery1( string1, string2 ); 18 cout << string1 << endl; 19 return 0; // indicates successful termination 20 } // end main 21 22 // What does this function do? 23 void mystery1( char *s1, const char *s2 ) 24 { 25 while ( *s1 != ' |