Error: 'cout' does not name a type

On line 50 I am getting an error that reads "error: 'cout' does not name a type. When I Google this issue I see multiple people saying to include the namespace std; which I have. Any other suggestions as to why I am getting this error?

#include <iostream>
#include <cstdlib>
#include <math.h>
using namespace std;

void getUserInput(int &num);
void whileNum(int &num, int &smallest, int &largest);

//initiate main
int main()
{//open main()

//establish integers
int num=0;
int smallest, largest;

getUserInput(num);


whileNum(num, smallest, largest);

system("Pause");
return 0;
}//close main()

//initiate called module getUserInput
void getUserInput(int &num)
{ //open getUserInput()
cout << "Enter a number of -99 to QUIT" << endl;
cin>> num;
} //close getUserInput()

void whileNum(int &num, int &smallest, int &largest)

{
while (num != -99);
{//open while()

largest=num;
smallest=num;
//if statements for maximum and minimum
if (num>largest)
largest=num;
if (num<smallest)
smallest=num;
}
} //close while()

//display largest and smallest values
cout << "Largest: " << largest << " Smallest: " << smallest << endl;

}//close while()

num=-99;
cout <<"Good-bye" << endl;

}
Please add code tags around the code in your post. Without them we can't easily tell what line is line 50.

Thank you jib for your help. I just needed to make sure to take out any unneeded {}
closed account (48T7M4Gy)
http://www.cplusplus.com/forum/beginner/193392/

Use code tags and avoid wasting effort by double posting. Thank you for your cooperation.
Topic archived. No new replies allowed.