#include <iostream>
#include <string>
#include <limits>
using namespace std;
int main()
{
    cout << "Please, enter a number\n";
    int n; // n is a number, it cannot be anything else
    // cin >> n reads a number. If it fails, it returns false,
    // so we check that condition in a loop:
    while( !(cin >> n) )
    {
        cout << "You need to enter a number\n";
        cin.clear(); // reset the error flags
        // here you still have unprocessed input. You have options:
        // 1. ignore:
      cin.ignore(numeric_limits<streamsize>::max(), '\n');
        // 2. read into a string
//        string str;
//        getline(cin, str);
        // 3. read into char (in a loop, since there may be many)
//        char c;
//        while(cin.get(c) && c != '\n')
//        {
//        }
    }
    cout << "Thank you for entering the number " << n << '\n';
}
