Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int variable;
- cout << "Ingrese Numero: ";
- //Si hay error ejecuta otra vez.
- while (!(cin >> variable)){
- cin.clear(); //Borra el error
- cin.ignore(10000, '\n'); //limpiamos hasta encontrar un salto de linea
- cout << "Ingrese Numero: ";
- }
- cout << "Su Numero: " << variable << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement