0
conditional statement
give a positive integer n , do the following : if 1 =<n=<9 then print the lowercase English word corresponding to the number (e.g; one for 1 , two for 2, ets) if n>9 print greater than 9
2 Antworten
+ 3
I'd use this because it is simple to understand:
switch (n) {
case 1:
cout << "one";
break;
....
default:
cout << "greater than 9";
break;
}
if (n==1) cout << "one";
else if (n==2) ...
works too.
0
switch (n) {
case 1:
cout << "one";
break;
....
default:
cout << "greater than 9";
break;
}
if (n==1) cout << "one";
else if (n==2) ...
works too.