I want to print the even and odd in a string rather than in binary for true false | 1 / 0; Why the output still print the boolean value?
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;
}
output:
enter the two numbers
9 16
nine
1
0
1
0
1
0
1