Hi, I have a project to do and hoping i can get some help onthis.. Here are the
ID: 3618937 • Letter: H
Question
Hi, I have a project to do and hoping i can get some help onthis..Here are the specs,
Develop Application
Menu Driven
Input File (csv file)
Process survey data
Generate Output for that data (plain text)
Data should be able to be reprocessed.
This is the input file
1,A,C,B,D,B,A,B,D,C,A
2,B,D,C,A,C,B,A,C,A,B
3,C,A,D,B,B,D,C,B,A,C
4,D,B,A,C,B,C,D,A,A,D
5,B,A,C,A,B,B,C,D,A,B
6,C,C,D,B,C,C,B,D,B,D
7,D,B,A,C,B,A,D,C,D,B
8,A,D,B,D,C,D,A,B,C,A
9,C,D,D,B,B,A,C,B,C,D
10,D,B,A,C,B,C,D,A,C,D
11,A,C,B,D,C,B,A,D,B,A
12,B,A,C,A,B,D,B,C,B,C
13,D,A,D,C,B,D,B,A,C,A
14,A,B,A,D,C,A,C,B,C,D
15,B,C,B,A,B,C,A,D,B,D
16,C,D,C,B,B,B,D,A,C,B
17,D,B,A,D,C,B,A,C,D,B
18,B,C,B,A,D,D,a,C,B,C
19,A,D,C,B,B,C,D,B,D,A
20,C,A,D,C,B,A,B,D,C,A
This is what i have so far for code...
#include <iomanip>
#include <fstream>
#include <iostream>
#include <string>
#include <ctime>
using namespace std;
int main()
{
char ch;
char *data = new char[15];
char response;
char *fileName = new char[10];
string id;
ifstream infile;
ofstream outfile;
outfile.open("data.csv",ios::app); //out filewhere data is going.
outfile << fixed << showpoint;
outfile << setprecision(2);
char dateStr[9];
_strdate(dateStr);
printf("The current date is %s ",dateStr);
cout << "This programturns data into percentages." << endl;
cout << "Enter 'Y'or 'y' to continue." <<endl;
cout << endl;
cin >> ch;
//prompt user toenter input file name
cout << " Enter the input file name:";
cin >> fileName;
//open input file
infile.open(fileName);
if (!infile.is_open())
{
cout << "unable to openthe input file.";
system("pause");
exit(1);
}
for (int i = 0; i < 10; i++)
{
infile >> data[i];
}
//read the input from the file
while ((infile >> id) != NULL)
{
cout << " " <<id << " ";
//disgard white space in between ID andanswers
infile.get(response);
}
for (int i = 0; i < 10; i++)
{
cout << i <<endl;
}
return 0;
}