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;
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);