Cod sursa(job #1506605)

Utilizator rexlcdTenea Mihai rexlcd Data 20 octombrie 2015 20:28:46
Problema A+B Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <iostream>
#include <cstdio>
#include <thread>

using namespace std;

FILE *f = fopen("adunare.in", "r");
FILE *g = fopen("adunare.out", "w");

int a,b,S;

inline void ScanA()
{
    fscanf(f, "%d", &a);
}

inline void ScanB()
{
    fscanf(f, "%d", &b);
}

inline void SumNr()
{
    S=a+b;
}

int main()
{
    thread x(ScanA);
    x.join();

    thread y(ScanB);
    y.join();

    thread sum(SumNr);
    sum.join();

    /*x.join();
    y.join();*/

    fprintf(g, "%d\n", S);
    fclose(f);
    fclose(g);
    return 0;
}