A U.S. social security number consists of a string of 9 digits, such as "444422333". Assume that input consists of a sequence of 9-digit social security numbers with no intervening spaces or separators of any kind: 111223333444422333123456789987654321... Assume that a char array named ssn suitable for storing a social security number as a C-string has been declared. Use this array to read in 3 successive social security numbers and print each one out on a line by itself.
.
.
Click on the title for the solution
.
.
for (int i=0; i<3; i++)
{
cin.get(ssn, 10);
for (int j=0; j<9; j++)
{
cout << ssn[j];
}
cout << "\n";
}
.
Click on the title for the solution
.
.
This is the answer:
:
for (int i=0; i<3; i++)
{
cin.get(ssn, 10);
for (int j=0; j<9; j++)
{
cout << ssn[j];
}
cout << "\n";
}
Comments
Post a Comment