You are viewing a single comment's thread. Return to all comments →
Here is a version of your code that accepts all possible answers, like negative integers or 0:
int main(){ int n; cin >> n;
string x[] = {"Greater than 9", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; if (n < 0 || n > 9) { cout << x[0] ; } else { cout << x[n] ; } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Conditional Statements
You are viewing a single comment's thread. Return to all comments →
Here is a version of your code that accepts all possible answers, like negative integers or 0:
int main(){ int n; cin >> n;
}