please solve my problem . . . . .

why this program is wrong ?
note : at the first line t is the number of tests .



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
    ifstream fin("problem.1");
    ofstream fout("output");
    int t,k,y,x;
    cin>>t;
    while(t>0)
    {
              fin>>x>>y;
              fout<<x+y<<endl;
              t--;
    }
    return 0;
}


What do you mean by saying that the program is wrong?
The program compiles and executes ok for me.
If I was to attempt some mind-reading, I'd guess the input file was not opened successfully.
I would say that it is wrong because there is no a check that the files were opened successfuly.
Oh thank you so much I understood that the name of file is incorrect !
So thank you very much, you really helped me :)
Topic archived. No new replies allowed.