Getting a weird error, help?

I am getting a weird error when compiling so I'm pretty sure I did something majorly wrong but cannot figure out what.

These are the errors that I'm receiving:
error: expected ‘while’ before numeric constant
return 0;
error: expected ‘(’ before numeric constant
error: expected ‘)’ before ‘;’ token
return 0;

And here is my code:

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>

using namespace std;

int main()
{

string userInput; // The user's input to wether or not he/she wants to repeat the program with another number.
int number; // The user's number to test.
int divisor; // The number we will be using to run the primality test.
bool flag; // Flag to set if the number is a prime or not at the end ofthe loop.
int result; // Variable needed for calculations.
bool reRun; // Variable to set to rerun the loop or not.
int squareRoot; // Variable for the square root of the number inputted by the user.

// Checking user's choice:
do while(reRun == true) {

// Setting the divisor to 2:
flag = true;

// Asking user for input:
cout << "Enter an integer greater than 1 to check if it is a prime number: ";
cin >> number;

// Getting the square root of the number:
squareRoot = sqrt(number);

// Main loop:
for(divisor = 2; divisor <= squareRoot; divisor++) {

// Main calculation:
result = number / divisor;

// Checking if the remainder is 0:
if(result == 0) {
flag = false;
break;
}

}

// Positive result:
if(flag == true) {
cout << "The number " << number << " is a prime number." << endl;

// Negative result:
} else if(flag == false) {
cout << "The number " << number << " is NOT a prime number." << endl;

// Detecting possible errors:
} else {
cout << "##### Error! Check Code! #####" << endl;
}

// Asking the user if he/she wants to run the program again:
cout << "Do you want to enter another number? (y or n): ";
cin >> userInput;

// Setting it to run again or not:
if(userInput == "y" || userInput == "Y") {
reRun = true;
} else {
cout << "Exiting program ..." << endl;
}

}

return 0;
}
Nevermind! Got it!

Was doing:
do while()
instead of:
do { stuff } while();
Topic archived. No new replies allowed.