Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ programming language. 1. Read the problem. Write a program that reads a .csv

ID: 3813376 • Letter: C

Question

C++ programming language.

1. Read the problem.

Write a program that reads a .csv file containing student survey data. The lines in the file vary by what information is being recorded. Read each line into a union according to the fields present and then output the data to the console with titles that make the data understandable.

The file is made up of several sets of four different records. Each row contains a record. Each record starts with the name of the record type: Student, Semester, Course, and Survey.

Student - contains the student id of the individual student who took the surveys (9-digit number).

Semester - contains the semester (S = spring, U = summer, F = fall), year, and room number (0, zero = online).

Course - contains the CIS course number, the end score and grade of the student.

Survey - contains the 5 ratings the student gave the instructor during the course, from 5 down to 1.

------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------

***** I will post .csv file contents at the very bottom, please use this data *****

(If you want, you can use the data to recreate the .csv file, or create a .txt file)

------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------

Your program must contain at least the following elements:

Your program should not assume that there are a certain number of records, but may assume that the records are grouped together so that they may be displayed as read.

*** Do not use string data types in the structs or union. ***

------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------

Student,100015418,,,,
Semester,U,2012,0,,
Course,1,97.3,A,,
Survey,5,5,4,4,3
Student,100581237,,,,
Semester,F,2012,501,,
Course,20,82.4,B,,
Survey,5,4,3,3,3
Student,100058746,,,,
Semester,F,2012,501,,
Course,20,71.7,C,,
Survey,4,4,3,3,3
Student,101548859,,,,
Semester,S,2013,503,,
Course,22,91.7,A,,
Survey,4,5,5,5,3
Student,100005843,,,,
Semester,S,2013,503,,
Course,22,78.7,C,,
Survey,3,3,3,3,2
Student,101254438,,,,
Semester,S,2013,505,,
Course,52,89.5,A,,
Survey,3,4,3,4,5
Student,104588628,,,,
Semester,S,2013,505,,
Course,52,81.1,B,,
Survey,5,4,4,4,3
Student,100253448,,,,
Semester,U,2013,0,,
Course,1,42.4,F,,
Survey,2,1,1,1,1
Student,103548861,,,,
Semester,F,2013,505,,
Course,23,88.8,A,,
Survey,4,4,4,5,4
Student,100004557,,,,
Semester,F,2013,505,,
Course,23,79.9,B,,
Survey,3,3,4,4,3
Student,105551473,,,,
Semester,F,2013,505,,
Course,23,91.8,A,,
Survey,5,5,5,5,5

a. Stucts defined that will hold complex data from the individual records. b. A union defined that will hold the data from the structs and other data that does not need to be stored in a struct. c. Code that reads the input .csv file and properly stores the data in the union. d. Code that displays the data in the console in a human readable fashion.

Explanation / Answer

#include #include #include using namespace std; int main() { string input_file_name; cout > input_file_name; ifstream input_stream(input_file_name.c_str()); string buffer; int rows = 0; while(!input_stream.eof()) { getline(input_stream,buffer,' '); if(!input_stream.eof()) rows = rows + 1; } cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote