A U.S. social security number consists of a string of 9 digits, such as "444422333". Declare a char array named ssn suitable for storing a social security number as a C-string, and write a statement that reads in the next 9 characters of standard input into this array. (Assume that the input consists of one big sequence of digits without spaces or newlines.)
.
.
Click on the title for the solution
.
.
char ssn[9];
cout << "Please enter a SSN: ";
cin.getline(ssn, 10);
cout << "The SSN entered was " << ssn << endl;
.
Click on the title for the solution
.
.
This is the answer:
.
cout << "Please enter a SSN: ";
cin.getline(ssn, 10);
cout << "The SSN entered was " << ssn << endl;
Comments
Post a Comment