-5

I tried

freopen("output.txt","w",stdout);

but somehow it's not working. Example program:

include <iostream>
using namespace std;

int main() 
{ 
  int t,n;
  cin >> t; 
  while (t--) 
  {
    cin >> n; 
    cout << 2 * n; 
  }
}

How to read input from file and generate output in file for above program?

1
  • I am new to hackercup. I have searched for whole day. But none of those were working. So i am asking it here.Deadline is near(2 days).I have to ask here to get responses asap.I have solved the problems but don't want to take risk. Jan 9, 2015 at 19:28

1 Answer 1

1

Got answer from some gentleman.Sharing it for wider audience.

I need not change the code for that

After compilation i can just run code this way

fileName.exe < input.txt >output.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.