1 2 3 4 5
|
if(highest<lowest);
{
lowest=highest;
highest=lowest;
}
| |
remove the semicolon from the end of that if statement.
Now consider this situation, lowest is 10, highest is 5, therefore the code enters the for loop above, and
lowest = highest;
is executed, now lowest = 10 and highest = 10, you have destroyed the value originally stored in highest, you need to use a temporary variable to hold one of the values while you swap them around, or better still, use
std::swap(highest,lowest);
There is some confusion in your code about how functions are used, the first line in main
void countDown(int lowest,int highest);
is a declaration of the function, and is correct.
The line before
return 0;
in main, is this
void countDown(int high,int low );
and is incorrect, I think you're trying to call the function here, when really you are just declaring it again. To call a function you don't specify the return type, change that line to this
countDown(high,low);
Finally, the function definition at the bottom has a semicolon after the parameter list, remove this, and now you should be good to go.
EDIT - To sum up, if statements, while statements, and function definitions do not end with semicolons, but that is a common mistake for beginners since most lines do. Also you should read up on how functions work, this site has some useful tutorials that could help you
http://cplusplus.com/doc/tutorial/
EDIT 2 - Also, I forgot to mention that you need to put your code in code tags, it makes it much easier for people to read and you will get a lot more help if the code is pleasant to look at. To use code tags you just need to type
put your code here
Welcome to the forum =)
EDIT 3 - Also, your for loop in countDown() is wrong, but I'll let the tutorials help you with that, no more edits now...honest