easy
just make pipe redirection
for example
main.cpp

int main()
{

 int i = 0;

for (int j = 0; j < 6 ; j++)
{
scanf ( "%d" , &i );
printf ( "input is %d" , i );

}

return 0;
}



and file a.txt

12
23
34
45
54
34
23
23
12
34
56


In windows it will create main.exe

so from command-line just write(main.exe and a.txt are in same folder
(assume))

main.exe < a.txt

output

12
23
34
45
54
34
23




On Fri, Mar 29, 2013 at 11:16 PM, champ <cham3...@gmail.com> wrote:

> Yes,I am using c++ and compiler vc++ and i am not able to take input
> through command line. And fstream method would be very time consuming
>
> On 3/27/13, Carlos Guia <carlos.guia.v...@gmail.com> wrote:
> > Since you mention fstream I'll guess you are using C++.
> >
> > You can use "freopen" to redirect input/output in code.
> >
> > Or, in a terminal you can run your program (called "program" here) as:
> > program < problem.in > problem.out
> >
> > Carlos Guía
> >
> >
> > On Tue, Mar 26, 2013 at 4:45 PM, champ <cham3...@gmail.com> wrote:
> >
> >> How i am supposed to take input and do output without using fstream?
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Google Code Jam" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to google-code+unsubscr...@googlegroups.com.
> >> To post to this group, send email to google-code@googlegroups.com.
> >> For more options, visit https://groups.google.com/groups/opt_out.
> >>
> >>
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Code Jam" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to google-code+unsubscr...@googlegroups.com.
> > To post to this group, send email to google-code@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to