Я хочу напечатать четное и нечетное в строке, а не в двоичном для истинного false | 1/0; Почему на выходе все еще выводится логическое значение?
int main() {
printf("enter the two numbers\n");
int a;
int b;
cin >> a >> b;
string arr[9] = {"one","two","three","four","five","six","seven","eight","nine"};
for (int i = a; i <= b; i++)
{
if(i <=9){
cout << arr[i-1] << "\n";
}else{
cout << ( i%2 == 0)? "even" : "odd"; // print out 1/0 but did not print out the even and odd
cout << "\n";
}
}
return 0;
}
на выходе:
enter the two numbers
9 16
nine
1
0
1
0
1
0
1