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.
1
Expert's answer
2013-02-27T04:19:55-0500
#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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS