We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Introduction
- Conditional Statements
- Discussions
Conditional Statements
Conditional Statements
Sort by
recency
|
833 Discussions
|
Please Login in order to post a comment
include
using namespace std;
int main(){ int n; cin>>n; string arr[10]={"zero","one","two","three","four","five","six","seven","eight","nine"}; if(n>9)cout<<"Greater than 9"; else cout<
}
I know this is supposed to train your if/else conditons and the task has constraints by giving you input how it wants it to but solution like this could save you unnecessary lines of code:
int main() { string n_temp; getline(cin, n_temp);
}
int n; cin >> n;
use the ||(OR) operator instead
adding else rather than use default statement