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; }
Comments
Leave a comment