Logo 
Search:

C++ Programming Articles

Submit Article
Home » Articles » C++ Programming » Mathematics ProgramRSS Feeds

Program to read marks of 10 students for 4 subjects and compute and display total marks and status of each student

Posted By: Easy Tutor     Category: C++ Programming     Views: 139016

A C++ Program that reads the marks obtained of ten students out of 100 in four papers.It computes and display the total marks and status of each student.

Code for Program to read marks of 10 students for 4 subjects and compute and display total marks and status of each student in C++ Programming

 #include<iostream.h>
 #include<iomanip.h>
 #include<conio.h>

 float total_marks(float []);

 main()
    {
       clrscr();

       float marks[10][4]={0};

       cout<<"\n Enter the marks of the ten students : "<<endl;

       for(int count_1=0;count_1<10;count_1++)
      {
         cout<<"\n Enter the marks obtained by student "<<count_1+1<<
                                " :"<<endl;
         cout<<"\t Subject-1 = ";
         cin>>marks[count_1][0];

         cout<<"\t Subject-2 = ";
         cin>>marks[count_1][1];

         cout<<"\t Subject-3 = ";
         cin>>marks[count_1][2];

         cout<<"\t Subject-4 = ";
         cin>>marks[count_1][3];
      }

       getch();
       clrscr();

       cout<<"\n *********************************  Result Sheet  *****************************"<<endl;
       cout<<"\n Student No.  Subject-1  Subject-2  Subject-3  Subject-4  ";
       cout<<"Total Marks  Status\n"<<endl;


       for(int count_2=0;count_2<10;count_2++)
      {
         cout<<setw(8)<<count_2+1;
         cout<<setw(13)<<marks[count_2][0];
         cout<<setw(11)<<marks[count_2][1];
         cout<<setw(11)<<marks[count_2][2];
         cout<<setw(11)<<marks[count_2][3];
         cout<<setw(11)<<total_marks(marks[count_2]);
         cout<<setw(12)<<((total_marks(marks[count_2])>=200)?"Pass":"Fail");
         cout<<endl;
      }

       cout<<"\n ******************************************************************************";

       getch();
       return 0;
    }

 /*************************************************************************///-----------------------  total_marks(float [])  -----------------------///*************************************************************************/float total_marks(float marks[])
    {
       float sum=0;

       for(int count=0;count<4;count++)
      sum+=marks[count];

       return sum;
    }
  
Share: 



Easy Tutor
Easy Tutor author of Program to read marks of 10 students for 4 subjects and compute and display total marks and status of each student is from United States. Easy Tutor says

Hello Friends,

I am Free Lance Tutor, who helped student in completing their homework.

I have 4 Years of hands on experience on helping student in completing their homework. I also guide them in doing their final year projects.

I have share many programs on this website for everyone to use freely, if you need further assistance, than please contact me on easytutor.2ya [at the rate] gmail [dot] com

I have special discount scheme for providing tutor services. I am providing tutor service to students from various contries, currently most of my students are from United States, India, Australia, Pakistan, Germany, UK and Canada.

I am also here to expand my technical network to receive more opportunity in my career, make friends to help them in resolving their technical problem, learn and share my knowledge, If you like to be my friend, Please send me friend request.

Thanks,
Happy Programming :)

 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Muhammad Nouman from United States Comment on: May 02
can any 1 please help me what is theproblems in this code

#include<iostream>
#include<iomanip>
#include<conio.h>
using namespace std;

float marks(float []);

int main()
{
float a,total_marks;
float marks[a][3]={0};

cout<<"\n Enter the marks of the ten students : "<<endl;
for(int i=0;i<10;i++)
{
cout<<"\n Enter the marks obtained by student "<<i+1<<" :"<<endl;
cout<<"\t Sub-1 = ";
cin>>marks[i][0];

cout<<"\t Sub-2 = ";
cin>>marks[i][1];

cout<<"\t Sub-3 = ";
cin>>marks[i][2];
}


cout<<"\n >>>>>>>> Result Sheet <<<<<<<<< "<<endl;
cout<<"\n Student No. Sub-1 Sub-2 Sub-3 ";
cout<<"Total Marks Status\n"<<endl;


for(int j=0;j<10;j++)
{
cout<<setw(8)<<j+1;
cout<<setw(13)<<marks[j][0];
cout<<setw(11)<<marks[j][1];
cout<<setw(11)<<marks[j][2];
cout<<setw(11)<<total_marks(marks[j]);
cout<<setw(12)<<((total_marks(marks[j])>=200)?"Pass":"Fail");
cout<<endl;
}

cout<<"\n <<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>";

system("pause");
return 0;
}
float sum(float marks)
{
float sum=0;

for(int k=0;k<3;k++)
{
sum+=marks[k];
}
return sum;
}

Muhammad Nouman from United States Comment on: May 02
there are errors in program as i am trying it in visual studio 2008 as c++

Rajashree Gs from India Comment on: Apr 06
I want a code for 3 students 5 subject marks using constructor overloading.can you please send me immediately.

View All Comments