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.)
LANGUAGE: C++
CHALLENGE:
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.)
SOLUTION:
char ssn[9]; cin.getline(ssn,10);