Question: Lab 12: EECS 138 C++ Note: Code for both tasks should be written in single.cpp source file. Ask user which task to perform. Your code


Lab 12: EECS 138 C++ Note: Code for both tasks should be written in single.cpp source file. Ask user which task to perform. Your code should exit after performing one task, Give error message in task 2 if file opening was failed as it's possible that user ran task 2 first and there was no file there to read. (Observe whether your code works if you run task 2 consecutively multiple times, and write your observation as comments on top of your source(*cpp) file ) Taskl: File Writing: To store 4 lab scores of five students 1. Initialize 2D char arrays with full names by taking input from user, using cin.getline0 function instead of simple cin. This 2D array holds the name record for all five student, where each row corresponds to one student. 2. Initialize 2D int type array for lab scores using rand0 function with no lab score greater than 10. This 2D array hold score of total 4 labs of all 5 students. Finally write the data into text file in the following format, where first row should be written as it 3. IS. First_Name Last_Name Labl Lab2 Lab3 Lab4 Namel Lnamel 10 763 Name2 Lname2 1 25 3 Name5 Lname5 3 2 59
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
