c++ i need the code for this problem please
Write a program that gets 5 or more sets of information from user in this format
First name last name Sex(Male –M, Female F) Age
Mellissa Henderson F 12
Marcus Cruz M 51
Anderson Mellissa F 19
Kenneth Lisa F 34
William Nancy F 24
Richard Eric M 69
Ronald William M 13
Christopher Elizabeth F 8
David Rodriguez M 11
Ryan Peter M 31
Your program should generate a 9 digit unique social security number for each person.
It should add Mr. for male Ms. for female when writing it to the screen.
Your program should calculate the percentage of females and males in that list.
The program should output all the values in the following format (sample)
Ms. Mellissa Henderson 313-20-4343
Mr.Marcus Cruz 603-49-7821
Ms. Anderson Mellissa 213-90-4341
Ms. Kenneth Lisa 313-20-4344
Ms. William Nancy 313-20-4345
Mr. Richard Eric 313-20-4346
Mr.Ronald William 313-20-4349
Ms. Christopher Elizabeth 613-69-7881
Mr.David Rodriguez 603-89-7823
Mr.. Ramirez Bianca 603-49-0821
Male = 40%
Female =60%
Your program should use
One and/or two dimensional arrays,
Loop(s) to read/write
At least one function
If else statement
Switch statement
Note: Could you plz go through this code and let me
know if u need any changes in this.Thank You
_________________
// names.txt
Mellissa Henderson F 12
Marcus Cruz M 51
Anderson Mellissa F 19
Kenneth Lisa F 34
William Nancy F 24
Richard Eric M 69
Ronald William M 13
Christopher Elizabeth F 8
David Rodriguez M 11
Ryan Peter M 31
_______________________
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
string generateUniqueSSN();
int main() {
srand(time(NULL));
int
kids=0,teen=0,adult=0,male=0,female=0,senior=0;
string fname,lname;
string ssn;
char gender;
int age;
string str,str1;
ifstream dataIn;
dataIn.open("names.txt");
//checking whether the file name is valid or not
if(dataIn.fail())
{
cout<<"** File Not Found **";
return 1;
}
else
{
//Reading the data from the file
while(dataIn>>fname>>lname>>gender>>age)
{
if(gender=='M')
{
str="Mr.";
male++;
}
else if(gender=='F')
{
str="Ms.";
female++;
}
if(age>=0 &&
age<=12)
{
str1="Kid";
kids++;
}
else if(age>=13 &&
age<=19)
{
str1="Teenager";
teen++;
}
else if(age>=21 &&
age<=59)
{
str1="Adult";
adult++;
}
else if(age>=60)
{
str1="Senior";
senior++;
}
ssn=generateUniqueSSN();
cout<<str<<fname<<" "<<lname<<"
"<<str1<<" "<<ssn<<endl;
}
dataIn.close();
cout<<"\n\nKids "<<kids<<endl;
cout<<"Teenagers
"<<teen<<endl;
cout<<"Adults "<<adult<<endl;
cout<<"Seniors
"<<senior<<endl;
cout<<"Male =
"<<((double)male/(male+female))*100<<"%"<<endl;
cout<<"Female
="<<((double)female/(male+female))*100<<"%"<<endl;
}
return 0;
}
string generateUniqueSSN()
{
string str="";
string
arr[]={"0","1","2","3","4","5","6","7","8","9"};
int num;
for(int i=0;i<9;i++)
{
num=rand()%(10);
if(i==3 || i==6)
{
str+="-";
}
str+=arr[num];
}
return str;
}
______________________________
Output:

_______________Could you plz rate me well.Thank
You
c++ i need the code for this problem please Write a program that gets 5 or...
Using C++ Write a program that gets 5 or more sets of information from user in this format First name last name Sex(Male –M, Female F) Age Mellissa Henderson F 12 Marcus Cruz M 51 Anderson Mellissa F 19 Kenneth Lisa F 34 William Nancy F 24 Richard Eric M 69 Ronald William M 13 Christopher Elizabeth F 8 David Rodriguez M 11 Ryan Peter M 31 Your program should generate a 9 digit unique social security number for...
need to be solved including (using namespace std) and without
using arrays
Problem: Write a CH program that considers many students (the number of students is given as an input to the program by the user). For each student the program allows the user to input the ID of the student (as integer number), the student gender (one character M for male and F for female), and grades of 2 tests (a Test grade is a value between 0 and...
Given the text file “Alamo defenders.txt” (attached to this assignment), write a simple Java program to do the following: - count how many names are in the file - find the longest full name in the file - find the longest single name (first, middle or last) in the file - find whether there were any Alamo defenders named “Jones” - write out, to the screen (console), all of the above information Alamo defenders.txt file: Juan Abamillo James L. Allen...
CREATE TWO C++ PROGRAMS : Program 1 Write a program that reads in babynames.txt (provided) and outputs the top 20 names, regardless of gender. The file has the following syntax: RANK# BoyName Boy#OfBirths Boy% GirlName Girl#OfBirths Girl% You should ignore the rank and percentages. Compare the number of births to rerank. Output should go to standard out. Program 2 Write a program that reads a text file containing floating-point numbers. Allow the user to specify the source file name on...
Write a program that reads in BabyNames.txt and produces two files, boynames.txt and girlnames.txt, separating the data for the boys and the girls, and listing them in alphabetical order. This is the code I have, Its not sorting the boys/girls names in seperate files. It is creatinf two files, but has all the names. I also need to alphabetize the names. with an Array. sort import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class BabyNames{ public static void main(String[]...
For the following task, I have written code in C and need help
in determining the cause(s) of a segmentation fault which occurs
when run.
**It prints the message on line 47 "printf("Reading the input
file and writing data to output file simultaneously..."); then
results in a segmentation fault (core dumped)
I am using mobaXterm v11.0 (GNU nano 2.0.9)
CSV (comma-separated values) is a popular file format to store
tabular kind of data. Each record is in a separate line...
C++ Create an application that searches a file of male and female first names. A link to the file is provided on the class webpage. "FirstNames2015.txt" is a list of the most popular baby names in the United States and was provided by the Social Security Administration. Each line in the file contains a boy's name and a girl's name. The file is space-delimited, meaning that the space character is used to separate the boy name from the girl name....