You are viewing a single comment's thread. Return to all comments →
int in; string num[10] = {"Greater than 9", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
cin >> in;
if(in > 9){ cout << num[0]; } else{ cout << num[in]; }
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 →
int in; string num[10] = {"Greater than 9", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
cin >> in;
if(in > 9){ cout << num[0]; } else{ cout << num[in]; }