1cout << endl << "Introduce an integer: ";
2p = scanf("%d", &x); //Scanf returns a false when the value doesn't match the correct format.
3getchar();
4
5while (p == false)
6{ cout << endl << "You didn't introduce an integger. Try again.";
7
8 cout << endl << "Introduce an integer: ";
9
10 p = scanf("%d", &x);
11 getchar();
12}