C++ How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (10th Edition)
Question
Book Icon
Chapter 21, Problem 21.25E
Program Plan Intro

Checking Validity of Social Number

Program Plan:

  • Include the required header files.
  • Declare the prototype of the function isValidSocialSecurityNumber.
  • Define the “isValidSocialSecurityNumber()” function.
    • Check whether str1.length()!=11 or str1.find_first_of("-")!=3 or str1.find_last_of("-")!=6.
      • If so then return false.
    • Traverse through str1.
      • If i is ‘-‘ at locations 3 or 6 then continue.
      • If the traversed character is not a digit then return false.
    • Return true.
  • Define the “main()” function
    • Create a string variable s and assign the social security number to it.
    • Make a call to function isValidSocialSecurityNumber with s and assign to ans.
    • If value of ans is 1 then display valid message.
    • Else display invalid message.

Blurred answer
Students have asked these similar questions
THIS IS NOT A GRADING ASSIGNMENT: Please only do lab 2.2 (bottom part of the first picture) For that Lab 2.2 do: *Part 1 (do the CODE, that's super important I need it) *Part 2 *Part 3 I also attached Section 2.5.2 which is part of the step 1 so you can read what is it about.   Thank you!
THIS IS NOT A GRADING ASSIGNMENT: Please only do lab 2.2 (bottom part of the first picture) For that Lab 2.2 do: *Part 1 *Part 2 *Part 3 I also attached Section 2.5.2 which is part of the step 1 so you can read what is it about.   Thank you!
can you please give me: * the code (step 3) *the list file (step 5) *and answer step 6   Thank you
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr