66 973
Assignments Done
99,2%
Successfully Done
In November 2018

Answer to Question #23738 in C++ for zara syed

Question #23738
Write a program that calculates the average of a group of five test scores,where the lowest score in the group os dropped.The program should not accept test scores lower than 0 or higher than 100.use the assert function to verify that the test scores enetered are legitimate.
Expert's answer
#include<iostream>
using namespace std;
boolassert_function(int a){// the assert function
if(a>-1&& a<101)
return true;
else
return false;

}
int main (){
int a=-1,i,p=0;


for (i=1;i<6;i++){
while(!assert_function(a)){// the assert functioncout<<"Eenter the test result number "<<i<<" :
";
cin>>a;
}
p+=a;
a=-1;
}

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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions