first_array.cpp
//Reads in 5 scores and shows how much each
//score differs from the highest score.
#include <iostream>
using namespace std;
const int SIZE = 5;
int main( )
{
int i, score[SIZE], max;
cout << "Enter " << SIZE <<
" scores:\n";
cin >> score[0];
max = score[0];
for (i = 1; i < SIZE; i++)
{
cin >> score[i];
if (score[i] > max)
max
= score[i]; //max is the largest of the values score[0],..., score[i].
}
cout << "The highest score is " << max
<< endl
<< "The scores
and their\n"
<< "differences
from the highest are:\n";
for (i = 0; i < SIZE; i++)
cout << score[i]
<< " off by " << (max - score[i]) << endl;
return 0;
}