Hmm, I copy-pasted your code. Then I removed the line-numbers, and compiled-linked it with your command: "g++ -Wall -pedantic -o kay kay.cpp".
Not a single warning, nor any error! Though I expected at least one for a missing "return 0;" at the end of main().
Or did you actually have the line numbers included? If so, C(++) sources, should not contain line numbers. Or you should comment them of course...
Try this (cleaned up) version of your code:
Code:
#include <iostream>
using namespace std;
int main (void) {
int answer, product;
product = 123*456;
while(1) {
cout << "Enter number" <<endl;
cin >> answer;
if (answer == product)
break;
cout << "wrong"<<endl;
}
cout << "well done"<<endl;
return 0;
}