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: 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. 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"; exit(1);   //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 << ". \n"; cin >> next; while ((next >= 0) && (index < NUMBER_QUIZZES) ) index++; cin >> next; return 0; }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
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"; exit(1);

 

//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 << ". \n";

cin >> next;

while ((next >= 0) && (index < NUMBER_QUIZZES) )

index++; cin >> next;

return 0;

}

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education