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
Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Raj is a newbie to the programming and while learning the programming language he came to know the following rules: · Each program must start with ''{'' and end with ''}''

Abstract Classes Abstract classes are the classes, which are written just to act as base classes. Consider the following classes.                 class base

Reference Oddities A reference variable can demote to any integer variable, be it in an array or a member variable from structure or class. Reference variables can demote to co

Question : (a) (i) What is a structure member in C? What is the relationship between a structure member and the structure? (ii) How can structure variables be declared in C?

Question 1 What are the different steps in executing a C program? Explain Question 2 What are the commonly used input/output functions in C? How are they accessed?

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 palindromes

Write a function that computes f(x) for a quadratic polynomial in x, such as the one in assignment 3. Use the function to plot f(x) from -10 to +10.

when you allocate memory with new[], you ought to free the memory via delete[]. While you allocate memory along 'new', then use 'delete' with no the brackets. You employ new[] to a

What's the order that objects in an array are destructed? Need assistance please explain it with example.