Please turn this into a while loop In a way so that it asks
Please turn this into a while loop. In a way so that it asks for and tests if the input is a number, any number. It cannot be anything other than a number. If it does not input a number it needs to say the statement again. that goes for both of the statements.
Solution
#include<iostream>
#include<limits>
using namespace std;
int main(){
float num1=0;
float num2=0;
cout << \"Enter first integer: \";
while(!(cin >> num1)){
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), \'\ \');
cout << \"Invalid input. Enter first integer: \";
}
cout << \"Enter second integer: \";
while(!(cin >> num2)){
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), \'\ \');
cout << \"Invalid input. Enter second integer: \";
}
cout << \"You first num: \" << num1 << endl;
cout << \"You second num: \" << num2 << endl;
}
