Logo 
Search:

C++ Programming Articles

Submit Article
Home » Articles » C++ Programming » Homework HelpRSS Feeds

Program that reads 10 students marks and displays average, lowest and highest marks

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

A C++ Program that reads the marks obtained of ten students out of 100. It also computes the average , lowest and highest marks.Then shows the difference of marks of every student from the average marks.

Code for Program that reads 10 students marks and displays average, lowest and highest marks in C++ Programming


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

 float average_marks(float []);
 float highest_marks(float []);
 float lowest_marks(float []);

 main()
    {
       clrscr();

       float marks[10]={0};

       cout<<"\n Enter the marks of the ten students : "<<endl;
       cout<<"\n\t Student No.       Marks Obtained"<<endl;

       for(int count_1=0;count_1<10;count_1++)
      {
         cout<<"\t\t"<<count_1+1<<"\t\t";
         cin>>marks[count_1];
      }

       getch();
       clrscr();

       cout<<"\n ********************  Result Sheet  ****************"<<endl;

       cout<<"\n Total Marks = 100"<<endl;
       cout<<" Average Marks  = "<<average_marks(marks)<<endl;
       cout<<" Highest Marks obtained = "<<highest_marks(marks)<<endl;
       cout<<" Lowest Marks obtained = "<<lowest_marks(marks)<<endl;

       cout<<"\n   Student No.    Marks Obtained     Diff. from Average Marks      Status"<<endl;

int y=10;
       for(int count_2=0;count_2<10;count_2++)
      {
         cout<<"\t"<<count_2+1<<"\t\t"<<marks[count_2];
         gotoxy(42,y);
         cout<<marks[count_2]-average_marks(marks)<<"\t\t   "<<
                 ((marks[count_2]>=50)?"Pass":"Fail")<<endl;
         y++;
      }

       getch();
       return 0;
    }


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

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

       return sum/10;
    }

 /*************************************************************************///---------------------  highest_marks(float [])  -----------------------///*************************************************************************/float highest_marks(float marks[])
    {
       float highest=marks[0];

       for(int count=0;count<10;count++)
      {
         if(marks[count]>highest)
        highest=marks[count];
      }

       return highest;
    }

 /*************************************************************************///----------------------  lowest_marks(float [])  -----------------------///*************************************************************************/float lowest_marks(float marks[])
    {
       float lowest=marks[0];

       for(int count=0;count<10;count++)
      {
         if(marks[count]<lowest)
        lowest=marks[count];
      }
       return lowest;
    }
  
Share: 



Easy Tutor
Easy Tutor author of Program that reads 10 students marks and displays average, lowest and highest marks 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].

 
No Comment Found, Be the First to post comment!