Answer to Question #341379 in C++ for Eymjelley

Question #341379

Write a program that will accept five (5) grades. Use an array in



storing the five (5) grades. Calculate the average of five (5) grades and



determine the remark of the average if PASSED or FAILED. Write a



function in accepting the five (5) grades, function in calculating the



average of the five (5) grades and a function in determining the remark of



the average.

1
Expert's answer
2022-05-16T16:08:08-0400


#include <iostream>
using std::cout;
using std::cin;
using std::endl;
//Implement  a function wich return average
double Average(int a[5])
{
  double sum=0.0;
  for(int i=0;i<5;i++)
    {
      sum+=a[i];
    }
  return sum/5.0;
}
//return remark
const char*remark(double aver)
{
  if(aver>=2.5)
    return "PASSED";
  else
    return "FAILED";
}
int main() {
  cout<<"Please input 5 marks\n";
  int marks[5];
  for(int i=0;i<5;i++)
    cin>>marks[i];
  double aver=Average(marks);
  cout<<"Average of any marks: "<<aver<<endl;
  cout<<"Resullts: "<<remark(aver)<<endl;
  return 0;
  
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS