Thanks for the excellent description, Bharath!

Another thing you can do is visit our quick-start guide at
http://code.google.com/codejam/faq.html#quickstart.

On Fri, Apr 9, 2010 at 2:33 AM, Bharath Raghavendran
<[email protected]>wrote:

> Let me give you an example. Suppose google asks you to write a code to
> add 2 numbers present in input file. It will make you download an
> input.in file which will look like below when opened in notepad or
> similar editors :
>
> 1 2
>
> Also, once you solve the question you will be expected to upload the
> output file and the source code. The output file will be expected to
> look like this :
>
> Case #1: 3
>
> There are 2 ways to solve this. One is make your input and output
> directly from/to the file. Second is do it from stdin/stdout and use
> redirection operators to make it use the files instead. I prefer the
> second one because its easier to test. For the first case, your code
> will look like this. (I didn't try compiling them. hope my code works)
>
> #include<fstream>
> using namespace std;
>
> int main()
> {
> ifstream fin("input.in");
> ofstream fout("output.out");
> int a,b,c;
> fin>>a>>b;
> c = a+b;
> fout<<"Case #1: "<<c<<endl;
> fin.close();
> fout.close();
> }
>
> Compile the code using "g++ code.cpp". You will get an executable as
> a.out in linux and a.exe in windows. Keep the input file (input.in) in
> the same folder as this executable and run the executable ("a.exe" in
> windows and "./a.out" in linux). This will give you the output file
> output.out in the same folder.
>
> For second option, in the previous code, replace fin by cin, fout by
> cout, remove declarations of fin and fout, remove lines closing these
> file handlers and use header file iostream instead of fstream. Compile
> the code. When you run the executable now, it will expect input in the
> terminal. You can put your sample inputs and test it. To run with
> file, use command "a.exe < input.in > output.out" in windows and
> "./a.out < input.in > output.out" in linux.
>
> On 9 April 2010 14:05, paulsmithenator <[email protected]> wrote:
> > How do you take any input in any of your programs?
> >
> > Paul Smith
> >
> > [email protected]
> >
> >
> >
> > On Fri, Apr 9, 2010 at 8:19 AM, dgcooldue <[email protected]> wrote:
> >> but how do we use them seems to be the main question here......
> >> We are confused how do we take them as input in our program..
> >>
> >> On Fri, Apr 9, 2010 at 3:20 AM, Luiz Gustavo Rocha Soares
> >> <[email protected]> wrote:
> >>>
> >>> What each number means is described in the problem description.
> >>> Luiz Gustavo Soares
> >>> http://luizsoares.net
> >>>
> >>>
> >>> On Thu, Apr 8, 2010 at 3:23 PM, sandy <tHe dAGgeR> <[email protected]
> >
> >>> wrote:
> >>>>
> >>>> what to do with the numbers in the .in files????
> >>>>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> Groups
> >>>> "google-codejam" group.
> >>>> To post to this group, send email to [email protected].
> >>>> To unsubscribe from this group, send email to
> >>>> [email protected]<google-code%[email protected]>
> .
> >>>> For more options, visit this group at
> >>>> http://groups.google.com/group/google-code?hl=en.
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups
> >>> "google-codejam" group.
> >>> To post to this group, send email to [email protected].
> >>> To unsubscribe from this group, send email to
> >>> [email protected]<google-code%[email protected]>
> .
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/google-code?hl=en.
> >>
> >>
> >>
> >> --
> >> With Regards,
> >> Dipanshu Gupta
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "google-codejam" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected]<google-code%[email protected]>
> .
> >> For more options, visit this group at
> >> http://groups.google.com/group/google-code?hl=en.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "google-codejam" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected]<google-code%[email protected]>
> .
> > For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-codejam" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-code%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to