(A-1) shows that string input
Can be tricky
Example of (A-1)
// instr1.cpp — reading more than one string
#include <iostream>
int main()
{
using namespace std;
const int ArSize = 20;
char name[ArSize];
char dessert[ArSize];
cout << "Enter your name:\n";
cin >> name;
cout << "Enter your favorite dessert:\n";
cin >> dessert;
cout << "I have some delicious " << dessert;
cout << " for you, " << name << [...]
The two most common ways of getting a string into an array
Are to initialize an array to a string constant and to read keyboard or file input into an array
(A-1) demonstrates these approaches by initializing one array to a quoted string and using cin to place an input string in a second array
The program (A-1) [...]