Odds/Evens numbers

Hello can you help me with one program in (C++)
I have to do program which have to say is there any odd and even numbers. I have to enter tree numbers.
Example: 235 - Yes ( because it has odd and even number)
333 - No (because it's only odds numbers.

I can do a program that displays it is odd or even, but here i have troube.

Thanks.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

#include <iostream>
#include <string>

int main()
{
    std::string a{};
    bool odd = 0; bool even = 0;
    
    std::cin >> a;
    for(auto c : a) std::atoi(&c) % 2 ? odd = 1 : even = 1;
    if(odd && even) std::cout << "Yes\n";
    else std::cout << "No\n";
    return 0;
}
1
2
3
4
5
6
7
#include <iostream>
int main()
{
   char a, b, c;
   std::cout << "Input three numbers: ";   std::cin >> a >> b >> c;
   std::cout << ( ( ( c - a ) % 2 ) || ( ( b - a ) % 2 ) ? "Yes\n" : "No\n" );
}
@lastchance
The way OP stated the numbers should be typed is as a single number, such as 222, or 353, so I thought OP wanted all the numbers to be entered at once with no delimiters.
Actually the OP wrote:
I have to enter tree numbers.



so I thought OP wanted all the numbers to be entered at once with no delimiters.

My code is agnostic to delimiters.
Topic archived. No new replies allowed.