Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

in c++ Design a modular program that reads students’ names followed by their tes

ID: 3858033 • Letter: I

Question

in c++

Design a modular program that reads students’ names followed by their test scores. The program should output each student’s name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and 100), and grade of type char. Your program must output each student’s name in this form: last name followed by a comma, followed by a space, followed by the first name; the name must be left justified. Suppose that the class has 20 students. Use an array of 20 components of type studentType. Data is attached for you to use in testing.

Data:

Please have:

Your structure chart as a screen shot or picture

source code with

The name of your program as a comment at the top of the file

IPO chart incorporated as comments after the name of the file

IPO charts for your functions as comments before the prototypes of your functions

A screen shot or picture of the results after running your program with your test data

Explanation / Answer

//header files

#include <iostream>

#include <iomanip>

#include <string>

using namespace std;

//structure definition

struct studentType

{

     string fName, lName;

     int Scores;

     char grade;/*this is optional if you want grade you can put other wise no need*/

};

//declaring structure

studentType students[20];

//main function

int main ()

{

     int n;//for number of students

     int heighest=0;

     //reading size

     cout<<"Enter number of studetns(max 20) "<<endl;

     cin >>n;

     //asking for details

     cout<<"Enter student details (first name, last name, score)"<<endl;

     int x=0;

     //reading details

     while(x<n)

     {

          //reading student iformation

          cin>>students[x].fName>>students[x].lName>>students[x].Scores;

          /* if you want to find grade remove following comments*/

          /*if(students[x].Scores >= 90)

          students[x].grade = 'A';

          else if(students[x].Scores >= 80)

          students[x].grade = 'B';

          else if(students[x].Scores >= 70)

          students[x].grade = 'C';

          else if(students[x].Scores >= 60)

          students[x].grade = 'D';

          else

          students[x].grade = 'F';*/

          //finding heighest score

          if(heighest<students[x].Scores)

              heighest=students[x].Scores;

          x++;

     }

     //Displaying heighest score and names

     cout<<"Heighest core is :"<<heighest<<endl;

     cout<<"Stundents with heighest score is :"<<endl;

     for(x=0;x<n;x++)

     {

          if(students[x].Scores==heighest)

              cout<<students[x].lName<<" "<<students[x].fName<<endl;

     }

     //displaying entire information

     cout<<"All students information"<<endl;

     for(x=0;x<n;x++)

     {

          cout.setf(ios::right);

          cout<<students[x].lName<<","<<students[x].fName<<" "<<students[x].Scores<<endl;

     }

     system("pause");

     return 0;

}//end of main