Example:
Examine the following code and determine what it does before compiling and running it:
#include
using namespace std;
int main()
{
char wkday[10];
cout << "\nWhat is the day after Sunday? ";
cin >> wkday;
cout << "\nYou are a spelling "; //now rearrange wkday[]
cout << wkday[3]; //'d' remember to start from 0
cout << wkday[5]; //'y'
cout << wkday[2]; //'n'
cout << wkday[4];
cout << wkday[0];
cout << wkday[1];
cout << "!" << endl;
cin.get();
cin.get();
return 0;
}
ASSIGNMENT #2
Lesson: Character strings, char Arrays, and cin.get()
Due Date: February 12
1.Write a program to store and print the name of your favorite book
in a char array. Initialize it at the time you declare the array.
Declare a second char array to contain the last name of the book's author
and enter that name later from the keyboard.
2.Modify the above program to print the name of the book's title both
forwards and backwards.
Save your source code and executable programs.