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.
You could omit the if/else since switch has a default option if it doesn't fit the other cases :)
switch(n){case1:cout<<"one";break;case2:cout<<"two";break;case3:cout<<"three";break;case4:cout<<"four";break;case5:cout<<"five";break;case6:cout<<"six";break;case7:cout<<"seven";break;case8:cout<<"eight";break;case9:cout<<"nine";break;default:cout<<"Greater than 9";}
Conditional Statements
You are viewing a single comment's thread. Return to all comments →
You could omit the if/else since switch has a default option if it doesn't fit the other cases :)