#include #include using namespace std; const int MAX=4; void numberthanten(int number) { if(number>10){ cout << "The number you entered is bigger than 10 !" << endl; }else if(number==10){ cout << "The number you entered is exactly 10 !" << endl; }else{ cout << "The number you entered is smaller than 10.." << endl; } } void twicethanten(int twice) { if(twice>10){ cout << "is bigger than 10 !]" << endl; }else if(twice==10){ cout << "equals 10 !]" << endl; }else{ cout << "is also smaller than 10 !]" << endl; } } void check(char input[MAX], int i) { if(!isdigit(input[i])) { cout << "NO letters, please try again!: "; cin.clear(); cin.ignore(99,'\n'); cin.get(input, MAX); } } int main(int argc, char *argv[]) { char input[MAX]; int transfer[4]; int twice; cout << "Please enter a number [3 digits]: "; cin.get(input, MAX); for(int i=0; i<4; i++) { while(!isdigit(input[i])) { check(input, i); i = 0; } if(isdigit(input[0]) && isdigit(input[1]) && isdigit(input[2])) { for(i=0; i<4; i++) { transfer[i] = input[i]; } } } numberthanten(transfer); twice = transfer * 2; twicethanten(twice); system("pause"); return EXIT_SUCCESS; }