1. #include #include int main(int argc, char **argv) { int i; char *word; int err; for (i = 1; i < argc; i++) { err=0; word = argv[i]; switch (word[0]) { case 'h': case 'H': if (strcmp(word+1, "ello")==0) cout << "Hello, I'm pleased to meet you!" << endl; else err=1; break; case 'g': case 'G': if (strcmp(word+1, "oodbye")==0) cout << "Goodbye. I've enjoyed talking with you." << endl; else err=1; break; case 'b': case 'B': if (strcmp(word+1, "usy")==0) cout << "Are you working or playing?" << endl; else err=1; break; case 'p': case 'P': if (strcmp(word+1, "ause")==0) cout << "I'm glad you were able to take a bit of time off from working so hard." << endl; else err=1; break; case 'w': case 'W': if (strcmp(word+1, "ork")==0) cout << "Too bad you can't be outside today. It's a beautiful day." << endl; else err=1; break; default: err=1; } if (err==1) cout << "I'm sorry, I don't understand what you said." << endl; } } 2. (a) Semicolon after "if" statement should be dropped (b) total should be initialized (c) The version of the question you had was valid; the actual question on the book was: while(y>0) { cout << y << endl; ++y; } ...which will loop endlessly if y is positive in the first place. As a result, the test should be: while (y < 0) 3. i=0; while (i int strlen(const char *); char *strcpy( char *, const char *); int strcmp( const char *, const char *); int main(int argc, char **argv) { char string1[]="hello world!"; cout <<"String 1 is: " <