Program is to define a class as student, C/C++ Programming

Program is to define a class as student:

Program is to define a class as student and display the records specific depending upon the number

class student

 {

 private:

   int roll,i;

   char name[20],grade;

   float per;

   int marks[5],total;

  int calculate()

     {

     per=total/5;

     return per;

     }

  public:

    student()// constructor assigning initial values

     {

     total=0;

     }

    void input();

    void disp();

   // void disp_spe();

  };

 

 void student::input()

   {

   cout<<" enter your name "<

   gets(name);

   cout<<" enter your roll no. "<

   cin>>roll;

   cout<<" enter the marks of five subjects "<

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

     {

     cin>>marks[i];

     total=total+marks[i];

     }

   }

  void student::disp()

     {

     clrscr();

    cout<<" R E P O R T   C A R D "<<"\n\n";

    cout<<" The name is : "<

    cout<<" The marks of all subjects is :"<<"\n";

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

       {

      cout<

       }

    calculate();

    cout<<" The percentage is :"<

     if(per>=85)

                cout<<" The grade is : A";

     else if(per>40)

                cout<<" the grade is : D";

     else

                cout<<" The grade is : B";

      }

 

  void student::disp_spe()

     {

     int rollno;

     cout<<" enter the  students roll no. you want report card "

     cin>>rollno;

     if(

 

  void main()

    {

    clrscr();

   student *data;

   data=new student;

   data->input();

   data->disp();

   data->disp_spe();

   delete data;

    }

Posted Date: 10/19/2012 5:32:00 AM | Location : United States







Related Discussions:- Program is to define a class as student, Assignment Help, Ask Question on Program is to define a class as student, Get Answer, Expert's Help, Program is to define a class as student Discussions

Write discussion on Program is to define a class as student
Your posts are moderated
Related Questions
C Program for RADIUS OF CIRCLE   #define PI 3.14159 main() {           float r,a;           clrscr();           printf("ENTER THE RADIUS OF A CIRCLE: ");

Define Bitwise Left Shift and Right Shift Operators: >? The bitwise shift operators shift their first operand right (>>) or left ( // Illustration of the bitwise right shi

write a program to find the area under the curve y=f(x) between x=a & x=b

can we use const data member in static. member function with example.

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''''a''''-''''z'''') and

Syntax rules for writing a destructor function Its name is the similar as that of the class to which it belongs, except that the first character of the name is the symbol t

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Logical Operators We say any expression that evaluates to zero is a FALSE logic condition and that evaluating to non-zero value is a TRUE condition. Logical operators are usefu

What is inheritance? Class, the vehicle, which is used to execute object-oriented concepts in C++, has given a new dimension to this idea of reusability. Many vendors now offer

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send