Write a program to use a conditional operator to find the
elements in a vector<int> that have odd value and double the value of
each such element.

Il compilatore trova un errore proprio nell'operatore condizionale.


codice:
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    vector<int> vec ;
    int a=0;

    while(cin>>a)
        vec.push_back(a);

    for(auto &c:vec){
        (c%2)==0 ? c=c : c=2c;
        }

    for (auto &c:vec)
        cout<<c<<" ";
}