Aflați cite componente impare sunt in fișierul proba. dat.


Răspuns :

#include <bits/stdc++.h>
using namespace std;
int x, ct;
int main()
{
    ifstream f("proba.dat");
    while(f >> x)
    {
        if(x % 2 == 1) ct ++;
    }
    cout << ct;
    return 0;
}