// Does anydody can help me with this program and make it work.
// this is the main
//Now just need to write average functions.
#include<iostream>
using namespace std;
// function prototypes.
void getScore();
void calcAvg();
void findLowest();
int main () {
int Score; //ret is for return :) another personal preference
cout<<"Please enter a score between 0 and 100 (inclusive): ";
cin>> Score;
while (Score < 0 || Score > 100) {
cout<<"Please enter a valid score: ";
cin>>Score;
}
return Score;
}
//Calculate average function call calcAverage
// four highest scores average.cpp : main project file.
#include<iostream>
using namespace std;
void calcAverage();
int main()
{
int scores[5], temp;
do
{
cout << "Please enter a score: ";
cin >> scores[0];
} while(scores[0] < 0 || scores[0] > 100);
for(int i = 1; i < 5; i++){
do {
cout << "\n\nPlease enter a score: ";
cin >> scores[i];
} while(scores[i] < 0 || scores[i] > 100);
if(scores[i] < scores[0]) {
temp = scores[i];
scores[i] = scores[0];
scores[0] = temp;
}
}
double average = (scores[1] + scores[2] + scores[3] + scores[4]) / 4;
cout << "\n\nAverage of the four highest scores: " << double(average) << "\n\n";
}
// four lowest scores average.cpp : main project file.
#include<iostream>
using namespace std;
void findLowest();
void calcAverage();
int calc_avg (int a, int b, int c, int d, int e) {
int low=a;
//what follows are different examples of and if statement
if (low > b) low = b;
(low > c) ? low = c : 1 ;
if (low > d) { low = d; }
if (low > e) {
low = e;
}