63 209
Assignments Done
99,3%
Successfully Done
In July 2018

Answer to Question #15347 in C++ for sakura

Question #15347
create array of students (lastname,firstname)
create array of subjects, grades and compute for the average of Grade per subject.
Determine if it is passed or failed.Compute GPA for each students and count all the passed and failed.
Example:
Enter number of subjects
Enter the name of subjects
Enter the name of students
Enter subjects
Enter grades of (name) for (subject)

name
subject prelim midterm final GPA Remarks
math 90 95 100 95 passed
number of pass:
number of fail:
Expert's answer
#include <string>
#include <iostream>
#include <conio.h>

using namespace std;
class Students{
public :
string lastname;
string firstname;
};

class Subjects{
public :
string name;
int grades;
};

int main()
{
Students students[10];
Subjects subjects[10];
int numberofsubjects;
double averageofGradepersubject[10];
int subject=0;
cout<<"Enter number of subjects: ";
cin>>numberofsubjects;
for(int i=0;i<numberofsubjects;i++){
cout<<"Enter the name of subjects: ";
cin>>subjects[i].name;
}
for(int i=0;i<3;i++){
cout<<"Enter the fisrt name of students: ";
cin>>students[i].firstname;
cout<<"Enter the last name of students: ";
cin>>students[i].lastname;
cout<<"Enter subjects: ";
cin>>subject;
cout<<"Enter grades of "<<students[i].firstname<<" for
"<<subjects[subject].name;
cin>>subjects[subject].grades;
}
for(int i=0;i<3;i++){
averageofGradepersubject[i]=subjects[i].grades/numberofsubjects;
}
cout<<"
subject prelim midterm final GPA Remarks
";
for(int i=0;i<numberofsubjects;i++){
cout<<subjects[i].name<<" "<<subjects[i].grades<<" "<<subjects[i].grades<<"
"<<averageofGradepersubject[i]<<"100";
}
cout<<"
Number of pass:
"<<numberofsubjects;
cout<<"
Number of fail::
"<<numberofsubjects-1;

getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions