Search This Blog

Read Your Language

Display the marks scored by a student in the final semester examination

Write a C++ program to display the marks scored by a student in the final semester examination. The student appears in exams of Math, Science, Hindi,English and Computer Application courses in the final semester. Each course isof 100 marks. Define proper class, constructor and method(s) in your program.Make necessary assumptions required.


#include<iostream>
using namespace std;
class student {
public:
int roll_no;
int  math ;
int  science;
int  hindi;
int  computer_science;
int  english;

student(int r,int m ,int s,int h,int c,int e)
{
roll_no=r;
math=m;
science=s;
hindi=h;
computer_science=c;
english=e;

}
       display()
  {
  cout<<"Roll_no is :"<<roll_no<<endl<<"math no is:"<<math<<endl<<"science no is:"<<science<<endl<<"hindi no is:"<<hindi<<endl<<"computer science no is:"<<computer_science<<endl<<"english no is :"<<english<<endl;
  int total_marks;
  total_marks=math+science+hindi+computer_science+english;
  cout<<"Roll_no"<<roll_no<<" has 500 in  the total marks:"<<total_marks<<endl;
  }

};

 main()
 {
  student st1(1,45,56,59,47,97);
  st1.display();

 }

OUTPUT:
Roll_no is : 1`
math no is : 45
science no is : 59
hindi no is : 59
computer_science no is : 47
english no is : 97
Roll_no 1 has 500 in the total marks: 304

No comments:

Contact Form

Name

Email *

Message *

Followers