Question: USE C Programming Language Turn in this program to the blackboard course website by the due date. Write a program to (1) open an input
USE C Programming Language
Turn in this program to the blackboard course website by the due date. Write a program to (1) open an input file called "ssn_in.txt" for reading. The file "ssn_in.txt" will be located in the same directory from which the executable from your program will be run. The file "ssn_in.txt" will contain a list of 9-digit social security numbers (SSNs), one per line. If the file "ssn_in.txt" does not open, print a message to the screen that the file "ssn_in.txt" does not exist, and exit the program. (2) Prompt the user of your program to enter a 9-digit social security number (SSN) and read-in that SSN from the keyboard. Check whether the number entered by the user is a valid SSN: i.e. a 9-digit non-negative integer greater than or equal to 100000000 and less than 1000000000. If it is not a valid SSN, print a message to the screen that the number entered is not a valid SSN, and exit the program For example, write to the screen: The number you entered (3163254) is not a valid 9-digit social security number. (3) If the number entered by the user in (2) is a valid SSN. then read through the SSNs in "ssn_in.txt" and check whether the SSN entered by the user is in that file. Count the number of SSNs in "ssn_in.txt" while you are reading them. (4) When (3) is complete, write out a message to the user containing the information that your program has determined. For example, write to the screen: The SSN you entered (33312333333) IS NOT among the 67 SSNs in the file ssn_in.txt. or: The SSN you entered (9111111111) IS among the 137 SSNs in the file ssn_in.txt
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
