I'm having a problem on my program, i just don't know how can i add a counter variable inside my loop and initialize its value again to perform certain statement on my program. Every time i run the program, whenever i input a character the MessageBox Functions keeps showing on my screen depending on how many letters i inputted. I want to loop every time a user enters a letter.
Here's my code:
#include <iostream>
#include <windows.h>
using namespace std;
main()
{
int x, y = 1000;
bool check = true;
do {
cout << "Enter a Number Only: ";
cin >> x;
if (x >= check) {
if (x > 1000) {
MessageBox(NULL, "Program Ends.", "Ends", MB_OK | MB_ICONINFORMATION);
}
}
else if (cin.fail()) {
cin.clear();
cin.ignore();
MessageBox(NULL, "Value: Not a Money.", "Error", MB_OK | MB_ICONERROR);
}
system("cls");
} while (x < 1000);
return 0;
}