Cod sursa(job #1604787)

Utilizator kix101Sergiu Ciupe kix101 Data 18 februarie 2016 16:34:16
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <fstream>
using namespace std;
int x,mx,mn,k;
int main()
{
    k=1;
    ifstream f("data.in");
    ofstream g("data.out");
    mx=99999;
    mn=-9999;
    //while (f>>x)   while (!f.eof())  se citesc toate numerele din fisier
    while (f>>x)
        if (x%2==0)
        {
            if (x>mx) k=0;
            mx=x;
        }
        else
        {
            if (x<mn) k=0;
            mn=x;
        }
    if (k==1) g << "Da";
        else g << "Nu";
    f.close();
    g.close();      //inchiderea fisierelor
    return 0;
}