55.2k views
1 vote
Write programming code in C++ for school-based grading system. The program should accept the Subject and the number of students from a user and store their details in an array of type Student (class). The student class should have: • studName, indexNo, remarks as variables of type string, marks as integer, and grade as char. • A void function called getData which is used to get students’ details (index number, name, and marks). • A void function called calculate which will work on the marks entered for a student and give the corresponding grade and remarks as give below. Marks Grade Remarks 70 – 100 A Excellent 60 – 69 B Very Good 50 – 59 C Pass 0 – 49 F Fail • Should be able to display the results for all students (index number, name, marks, grade, remarks). 2. Draw a flowchart for the calculate function above. 3. Create a folder with name format ICTJ254_indexnumber (eg

User Chirag
by
7.9k points

1 Answer

5 votes

Answer:

Step-by-step explanation:

// C++ Program to Find Grade of Student

// -------codescracker.com-------

#include<iostream>

using namespace std;

int main()

{

int i;

float mark, sum=0, avg;

cout<<"Enter Marks obtained in 5 Subjects: ";

for(i=0; i<5; i++)

{

cin>>mark;

sum = sum+mark;

}

avg = sum/5;

cout<<"\\Grade = ";

if(avg>=91 && avg<=100)

cout<<"A1";

else if(avg>=81 && avg<91)

cout<<"A2";

else if(avg>=71 && avg<81)

cout<<"B1";

else if(avg>=61 && avg<71)

cout<<"B2";

else if(avg>=51 && avg<61)

cout<<"C1";

else if(avg>=41 && avg<51)

cout<<"C2";

else if(avg>=33 && avg<41)

cout<<"D";

else if(avg>=21 && avg<33)

cout<<"E1";

else if(avg>=0 && avg<21)

cout<<"E2";

else

cout<<"Invalid!";

cout<<endl;

return 0;

}

User Bungles
by
7.4k points