C++ How to Program (10th Edition)
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
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
I need help creating the network diagram and then revising it for the modified activity times.
Activity No. Activity Time (weeks) Immediate Predecessors 1 Requirements collection 3 2 Requirements structuring 4 1 3 Process analysis 3 2 4 Data analysis 3 2 5 Logical design 50 3,4 6 Physical design 5 5 7 Implementation 6 6 c. Using the information from part b, prepare a network diagram. Identify the critical path.
Given the following Extended-BNF grammar of the basic mathematical expressions:  Show the derivation steps for the expression: ( 2 + 3 ) * 6 – 20 / ( 3 + 1 ) Draw the parsing tree of this expression. SEE IMAGE
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