The similar question is not what I asking.
Here,
#include <iostream>
using namespace std;
int main(){
int base, inputX;
int aCounter = 0;
do {
std::cout << "Please enter a value between 1-10" << endl;
std::cin >> inputX;
if (!cin) {
std::cout << "Error! number only" << endl;
std::cin.clear();
std::cin.ignore(100, '\n');
}else if (inputX <= 0 && inputX > 18) {
std::cout << "Error! please enter a correct number" << endl;
}else{
base = inputX;
std:;cout << "The number for base is " << base << "." << endl;
aCounter++ ;
}
}while (aCounter == 0);
}
If I input other than number, it loop again and run well. If I input a number even is 0 or negative, it straight end the loop and print the else statement, what happen to else if?