In Psuedocode You are given a program that ALREADY has a single STRING array. Th
ID: 3573909 • Letter: I
Question
In Psuedocode
You are given a program that ALREADY has a single STRING array. The array is called STRING[] studentNames, and contains the names of students. Using a module, you are to build a parallel array named studentGrades, and then fill that array by displaying each of the student’s names and asking the user to enter a grade for that student. The array size is defined by the variable INT listSize. In this program, I have the following code already written and waiting for your use, including the module call: DECLARE INT[] studentGrades studentGrades = getGradesFromUser(studentIDs, listSize) Write the module getGradesFromUser() which will create a new array to hold student grades and then fill that array by displaying each student name and asking the user to input a grade for that student. After you have filled the array return it to the main program.
Explanation / Answer
//given that student name is array holding studentnames.
//so to define the function
int getGradesFromUser(studentIDs,listsize){
STRING studentGrades[listsize];
STRING *ptr;
for(int i=0;i<listsize;i++){
cout<<" Student Name:"<<studentName[i];
cout<<" Please enter your grade:";
cin>>studentGrades[i];
}
ptr= & studentGrade[0];
return ptr;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.