Program With Stubs Driver To Test

For the assignment we were supposed to make up a random program given three variables:

getTotal()
getAverage()
compareToHighScore()

And use stubs for all the functions, and then in the same program we were to create a driver to test all of our stubs this is what I came up with:


But on the last function the compareToHighScore function, I am getting an error that says: function definition is not allowed here
Last edited on
You've got your brackets in the wrong place. Move the closing bracket for the main function from the end of the program to before double getTotal().

And then move using namespace std to the start of the program, after #include<iostream>.

Lastly you do not need semi-colons after the function name and parameter list, for example, remove the semi-colon form the end of double getTotal(int points, int fouls); on line 25
Last edited on
Well you actually have a few errors here. First you need to put the functions outside of main, right now you are trying to define the functions inside main(). Second the first two function definitions are a bit wrong, you don't need the ; at the end.
1
2
double getTotal(int points, int fouls); //You have this
double getTotal(int points, int fouls) //It should be like this 


Example of defining functions outside of main()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>

double someFunction (int someparameter);

int main()
{
     //main stuff
}//End main

//Functions
double someFunction (int someparameter)
{
    //function stuff
return adouble;
}
machinafour, BardaTheHobo thanks so much guys! I'm still new at this and these little kind of errors have been my falling so far appreciate your time!
Please don't delete your question after you've received an answer. It damages the ability of this forum to act as an archive of advice that others can learn from.
Topic archived. No new replies allowed.