1. Engineering
  2. Computer Science
  3. c homework moderate length will rate from multiple accounts you...

Question: c homework moderate length will rate from multiple accounts you...

Question details

C++ homework. Moderate length: will rate from multiple accounts! You have my word!Problem 2 Overview: In this question you will write a program that reads a.csv file with up to 100 lines and stores the information in an array of structs and also writes the lines whose gpa is greater than a minimum value to a output .csv file. Each line of the input file corresponds to a struct element in the array. Then you will allow the user to print the contents of the array Specifics 1. Your program should handle up to three command line arguments: the name of a .csv file to read, name of the output.csv file and a minimum gpa Input and output files need to be stored in the same directory as your program a. b. You can use the file named data.csv as an input file, on Moodle, or create your own if you prefer Each line in the files must follow the format <USERNAME>,<GPA>,«AGE. C. 2. Create an array that holds the User struct objects. Use the following struct declaration CSCI 2270 -Data Structures Instructors: Shayon Gupta, Ashutosh Trivedi, Maciej Zagrodzki Assignment 1, January 2019 struct User f string username float gpa; int age; l; 3. Reading from the input file, data.csv a. Each line of the file can be read using getline function b. Parse each line using stringstream and convert each entry into its appropriate data type. USERNAME should be a string, GPA should be a float, and AGE should be an int. (Hint: Use stoi, stof functions to convert from strings to numbers) 4. Writing into a file a. Write the <USERNAME>,GPA>,<AGE of the students, whose GPA> is more than the minimum gpa (read as a command line argument) into a csv file 5. Write a function named addUser to perform the following operations5. Write a function named addUser to perform the following operations: The addUser function has the following signature // length: Number of items currently stored in the array Void addUser(User users[], string_username, float_gpa, int _age, int length); a. b. Instantiate a struct and store the USERNAME, GPA, AGE values in it c. Add the struct to the users array 6. Write a function named printList to perform the following operations: a. printList function has the following signature // length: Number of items in the array void printList(const User usersl], int length); b. Loop through the populated array Print out each element of the list in the following format c. USERNAME> KGPA>] age: AGusing the below cout statement CSCI 2270 -Data Structures Instructors: Shayon Gupta, Ashutosh Trivedi, Maciej Zagrodzki Assignment 1, January 2019 std..cout << user.username << Г << user.gpa << J age. <<user.age << std:endl Example, Gupta [4] age: 25 d. Call the printList function in main after the array has been filled with data 7. Be sure to close your file when you are done 8. Functions addUser, printList and main need to be implemented in Moodle Testcase 1 File Contents: data.csv Acton,2.79,28 Gretchen,3.23,27 Regan,3.75,23 Rinah,2.78,22 Your Output Acton [2.79] age: 28 Gretchen [3.23] age: 27 Regan [3.75] age: 23 Rinah [2.78] age: 22

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution