a c++ program that reads 5 scores and how much each scores differ from the the highest score
#include <iostream>
using namespace std;
void main(){
float scores[5],max=0;
for(int i=0;i<5;i++){
cout<<"Enter score "<<(i+1)<<": ";
cin >> scores[i];
if(scores[i]>max){
max=scores[i];
}
}
cout<<"\nThe highest score is: "<<max<<"\n\n";
for(int i=0;i<5;i++){
int diff=max-scores[i];
cout<<"The score "<<scores[i]<<" differs from max by "<<diff<<"\n";
}
system("pause");
}
Comments
Leave a comment