C++ Find Percentage and Grade of 3 Students






 

#include<iostream.h>
class student
{
float marks[3];

public:

void readmarks();
void grade();
};

void student::readmarks()
{
int calculate;
int s=0;
for(int i=0;i<=2;i++)
{
cout<<"\nEnter the marks :";
cin>>marks;
s=s+marks;
}
calculate=s/3;
cout<<"The Percentage is :\t"<<calculate;
cout<<"\n";
}

void student::grade()
{
float avg,s=0;
for(int j=0;j<=2;j++)
{
s=s+marks[j];
}
avg=s/3;

if(avg>=90&&avg<=100)
cout<<"\nGrade Is A "<<"\n";

else if(avg>=80&&avg<90)
cout<<"\nGrade Is B "<<"\n";

else if(avg>=70&&avg<80)
cout<<"\nGrade Is C "<<"\n";

else if(avg>=60&&avg<70)
cout<<"\nGrade Is D "<<"\n";

else if(avg>=50&&avg<60)
cout<<"\nGrade Is E "<<"\n";

else if(avg>50)
cout<<"\nGrade Is F "<<"\n";

}
void main()
{
student S[3];
for(int p=0;p<=2;p++)
{
S[p].readmarks();
S[p].grade();
}
}

Click here for more C++ Programs

info@C++

C++ (pronounced "cee plus plus").C++ is a general-purpose,powerful programming language.C++ is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. C++ was Developed by Bjarne Stroustrup starting in 1979.C++ adds OOPS-object oriented features such as classes, and other enhancements to the C programming language.


C++ Find Percentage and Grade of 3 Students
3 - 1 Vote




Further Reading:
http://en.wikipedia.org/wiki/Find
http://en.wikipedia.org/wiki/Percentage
http://en.wikipedia.org/wiki/And
http://en.wikipedia.org/wiki/Grade

You read About: C++ Find Percentage and Grade of 3 Students

Posted by: Prateek on October 6, 2011


Previous Post: « Next Post: »

© 2017 Trendfy. All rights reserved
Blog Managed by Prateek Jaiswal