Search & Find out

Sunday, December 6, 2009

STUDENT GRADE

#include "iostream.h"
#include "conio.h"
class grade
{
    private:
        int r,m[3];
        float p;
    public:
        void accept ()
        {
            cout << "Enter student details\n\n";
            cout << "Enter the Roll Number: ";
            cin  >> r;
            cout << "Enter marks of subject 1: ";
            cin  >> m[0];
            cout << "Enter marks of subject 2: ";
            cin  >> m[1];
            cout << "Enter marks of subject 3: ";
            cin  >> m[2];
        }
        void cal ();
};
void grade :: cal ()
{
    clrscr ();
    cout << "Roll Number:\t" << r;
    p = (m[0] + m[1] + m[2]) / 3;
    cout << endl << "Percentage:\t" << p << "%" << endl;
    if (p < 40.00)
        cout <<    "Grade:\t\tF";
    else if (p >= 40.00 && p < 60.00)
        cout << "Grade:\t\tB";
    else if (p >= 60.00 && p < 75.00)
        cout << "Grade:\t\tA";
    else if (p >= 75.00 && p < 100.00)
        cout << "Grade:\t\tDistinction";
    else
        cout << "Invalid Entries";
}
void main ()
{
    clrscr ();
    grade G;
    G.accept ();
    G.cal ();
getch ();
}


Get the executable ( .exe ) file for this program..
Download






0 comments:

Post a Comment

 

My Blog List

Term of Use