Answer to Question #39989 in C++ for moalosi tshipe
QUESTION:The Department of Immigration has a little problem and they have tasked you with solving it. They have a text file that has a list of citizens and their Omang numbers. The problem is that they do not know which names are male and which ones are female. To find out they have to look at each name separately. Since there are a lot of names in the file, they have decided to ask you to write a program that will read the name of the file from the keyboard and separate males from females. Males should be written into a file called males.txt and females should be written into a file called females.txt. There is also a chance that the Omang numbers in the file could be invalid, so you should write all the invalid entries to invalid.txt. The name of the original file should read from the keyboard.
The output file should be in such that each entry is in a single line. Each line contains surname, name (including middle names) and Omang number separated by space. HINTS
1. When reading and writing to a file, the input file should be in the same location with your program, e.g. the .txt file should be saved in the same location/ folder where the program appears, otherwise the compile won’t see the input file.
2. The length of the file is not fixed, so your program should be able to read any file of any length.
3. To determine which entry is a male or female from the input file, if the fifth digit of the ID is 1, then the person is male, if its 2 then it’s a female.
4. INVALID ENTRIES:
a. ID is not equal to 9 digits
b. ID has other characters that are not numbers
c. The fifth digit of the ID is not either 1 or 2.
5. A test file is provided in blackboard, so u can use it to test your programs. Note that a longer test file can be used, so don’t fix the length of your file to the one provided on blackboard
Dear customer, Unfortunately, your question requires a lot of work and cannot be done for free. Please submit it with all requirements as an assignment to our control panel and we'll assist you.