pksingh290's blog

By pksingh290, history, 4 years ago, In English

hello everyone.i want to know how to save my output file in cpp to submit in ongoing fb hackercup contest .i tried to submit my first sollution but it lead to timeout since i tried to copy paste my output file in a text file .i need your help to submit my sollution.thanks for your help..

  • Vote: I like it
  • -41
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

Include these lines in your code:-
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
Although there is no reason I could think for timeout when you copy-paste the output.These lines just takes the input from the file input.txt and stores the output in output.txt.Maybe you need to check your code again.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it
»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Compile it with: g++ filename.txt -o a

Execute and redirect the output with: ./a > output.txt