Untitled
raw download clone
TEXT
views 23
,
size 410 b
#include <fstream>

using namespace std;

int main()
{
    ifstream f("calcul3.in");
    ofstream g("calcul3.out");
    int e, x;
    char c;
    f >> e;
    g << e;
    while(f >> c){
        if(c !='='){
            f >> x;
            g << c<< x;
            if(c =='+')
                e+=x;
            else
                e-=x;
        }
    }
    g <<"="<<e;

    return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.