// 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;
}

Edited 5 Years Ago by Nick Evan: Added [CODE] tags, moved post to new thread

Why do you have more than one main()? See if you can organize these around one main, and then someone can help you figure out how to fill in the blanks.

...
int main () {
  int Score; //ret is for return :) another personal preference
  ...
  return Score;
}

Unless you have a VERY GOOD reason, this is not a good "personal preference". Your main() must return zero (0). Any other return value besides zero (0) indicates some sort of program error.

Edited 5 Years Ago by Fbody: n/a

Thank you very. it not running yet but, you help a lot. thank you for your help

This article has been dead for over six months. Start a new discussion instead.