Question: In this exercise, you modify the Social Security Number program from the chapter. If necessary, create a new project named Intermediate24 Project and save it
In this exercise, you modify the Social Security Number program from the chapter. If necessary, create a new project named Intermediate24 Project and save it in the Cpp8\Chap13 folder. Enter the instructions from Figure 13-22 into a source file named Intermediate24.cpp. Change the filename in the first comment. Before inserting the missing hyphens, verify that the nine characters entered by the user are numeric. Save and then run and test the program.

1 //SSN.cpp - displays the Social Security number with hyphens 2 //Created/revised by on 3 4 #include 5 #include 6 using namespace std; 7 8 int main) 9 { string ssn = ""; cout "Nine-character Social Security number: "; getline(cin, ssn); 10 11 12 13 if (ssn. lengthO 9) { //insert hyphens ssn.insert(3, "-"); //xxx-xxxxxx ssn.insert(6, "-"); //xxx-xx-XXXX cout
Step by Step Solution
3.40 Rating (163 Votes )
There are 3 Steps involved in it
Intermediate24cpp displays the Social Security number with hyphens Createdrevised by on include inc... View full answer
Get step-by-step solutions from verified subject matter experts
