Question This exercise give you practice working with a two-dimensional array. the Example 7.14 on two-dimensional arrays, recall that I loaded the array using an Initializer list. Modify Example...



Question




  1. This exercise  give you practice working with a two-dimensional array. the Example 7.14 on two-dimensional arrays, recall that I loaded the array using an Initializer list.  Modify Example 7.14.  Instead of using an initializer list to load the array, create 2 functions:


    1. loadArray – function “loadArray“ will have 1 parameter which will be the grade array. The function will allow the user to enter 12 quiz grades (3 for each student), store each quiz grade in the appropriate element of the grade array, and return an int representing the number of quizzes entered (12).  “loadArray” will use nested loops to prompt the user to enter the 12 grades.  It will count each grade entered and return the number of quizzes entered.


    2. loadFromFile – function “loadFromFile” will have 1 parameter which will be the grade array. The function will return an int representing the number of quizzes read(12).  “loadFromFile” will use nested loops to read the values from the file and store each quiz grade in the appropriate element of the grade array.  It will count each grade read and return the number of quizzes entered.  I have include file “txt” in the Module 14 download.




Define both functions in your modified version of example 7.14.  For testing purposes, invoke both functions, but always leave one of those functions calls commented out


This is what I have so far



//load from file


loadFromFile(int myGrade[ ] [NUMBER_QUIZZES])


using namespace std; ifstream fin; ofstream fout; fin.open("quizzes.txt"); if (fin.fail())


cout < "input="" file="" opening="" failed.="" \n";="">



//Load from keyboard int loadArray(int grade[ ] [NUMBER_QUIZZES])


using namespace std; int next=0, index = 0;


cout < "enter="" quiz="" grade="" "="">< grade="">< "="" for="" student="" #="" "="">< index="">< ".="">


cin >> next;


while ((next >= 0) && (index < number_quizzes)="">


index++; cin >> next;


return 0;


}



Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here