Răspuns :
#include <iostream>
#include <fstream>
using namespace std;
ifstream fib("BAC.IN");
void adunare(int a,int b,int &c){
c=a+b;
}
int main(){
int nr,s=0;
while(fib>>nr){
adunare(s,nr,s);
}
cout<<s;
return 0;
}
#include <fstream>
using namespace std;
ifstream fib("BAC.IN");
void adunare(int a,int b,int &c){
c=a+b;
}
int main(){
int nr,s=0;
while(fib>>nr){
adunare(s,nr,s);
}
cout<<s;
return 0;
}
#include <iostream>#include <fstream>
using namespace std;
void eval(int a, int b, int &rez){ rez=a+b;}
int main(){ ifstream f("numere.in"); int nr,S=0; while(!f.eof()) { f>>nr; eval(S,nr,S); } cout<<S; return 0;}
using namespace std;
void eval(int a, int b, int &rez){ rez=a+b;}
int main(){ ifstream f("numere.in"); int nr,S=0; while(!f.eof()) { f>>nr; eval(S,nr,S); } cout<<S; return 0;}