#include <iostream>
int main()
{
int number;
using namespace std;
cout<<"write number between 1 and 10:"<<endl;
cin>>number;
if (number<=10 && number>=1)
cout<<"correct!"<< endl;
else
do{
cout<<"wrong! new number:"<<endl;
cin>>number;
}
while(number>10 && number<1);
}
The loop only goes once and ends directly :( i want it to go endlessly until condition is met. Im very new to c++ so any help is appreciated :)
number>10 && number<1This condition can never possibly be true. There is no number that is simultaneously greater than 10 and less than 1.