Hi, what's the best way to remove the do/while loop and just have it go once? It's looping nonstop so the program is never ending and it's not supposed to do that? Suggestions?
Here describe coding for an integer number is not true cin >> number;
cin.clear();
cin.ignore();
in this place, you can use int ignore values which can produce the best "Please enter numeric data only! Your number: "; that give you a clear integer number for out put
#include <iostream>
using namespace std;
int main()
{
int number;
do
{
cout << "Please enter an integer number.";
while (!(cin >> number))
{
cout << "Please enter numeric data only! Your number: ";
cin.clear();
cin.ignore();
}
while (number < 0)
{
cout << "Please enter positive numbers only! Your number: ";
cin >> number;
cin.clear();
cin.ignore();