Computer Science Canada

How to do CCC Senior input and output ?

Author:  nike52 [ Fri Mar 14, 2008 9:41 am ]
Post subject:  How to do CCC Senior input and output ?

I'm confused about how to do CCC senior input and output.

http://www.cemc.uwaterloo.ca/ccc/test_routines/test.cpp

Quote:
How to run the program:


The program reads from "standard input" and writes to "standard output."
That is, compile such as:
g++ test.cc
Then run the program as:
./a.out < input.txt
or, if you wish to just type numbers at the program, run by
./a.out


I think I got the first part figured out, I compiled and saved the file as g++ test.cc, the file is a special icon.
I don't get the second part where it says

Quote:
Then run the program as:
./a.out < input.txt
or, if you wish to just type numbers at the program, run by
./a.out


or how the text file gets connected with the program either.

How do you do this too?
Quote:
4. You should assume that
 all input is from a file named sX.in, where X is the problem number (1  X  5).
 all output is to a file named sX.out, where X is the problem number (1  X  5).



How would you do file input and out for CCC senior?

Author:  A.J [ Fri Mar 14, 2008 9:45 am ]
Post subject:  Re: How to do CCC Senior input and output ?

well the in/output for this year was read from "sx.in", where 'x' is the question number.

A.J

Author:  Tony [ Fri Mar 14, 2008 9:51 am ]
Post subject:  Re: How to do CCC Senior input and output ?

nike52 @ Fri Mar 14, 2008 9:41 am wrote:
I think I got the first part figured out

I doubt it. The instructions are for the command prompt. g++ is the compiler, test.cpp is the sample source file you download. There are no icons involves.

Author:  nike52 [ Fri Mar 14, 2008 9:54 am ]
Post subject:  Re: How to do CCC Senior input and output ?

Ack. I forgot to mention file input and output for, C++, in particular.

So I just assume textfiles for input are sx.in and textfiles for output are sx.out?

Alright, that sounds easier and simpler. Thanks for the help A.J. Smile

Quote:
I doubt it. The instructions are for the command prompt. g++ is the compiler, test.cpp is the sample source file you download. There are no icons involves.


I'm totally clueless. I never used the command prompt. I'll try it out though. I use Dev c++ bloodshed. Is there a way to do it with bloodshed too?

What I really need is step by step instructions like a baby, if anybody could do that for me . BooHoo

Author:  Tony [ Fri Mar 14, 2008 10:14 am ]
Post subject:  Re: How to do CCC Senior input and output ?

nike52 @ Fri Mar 14, 2008 9:54 am wrote:
I never used the command prompt.

I've suspected that from your original post... but the command prompt is your absolute best friend when it comes to programming. Seriously. Graphical IDEs are shiny, but they over-complicate a lot of really basic tasks. You can certainly compile the source through Bloodshed, but you've got to realize that the sample programs (and the competition itself) is meant for the console.

Author:  nike52 [ Fri Mar 14, 2008 10:22 am ]
Post subject:  Re: How to do CCC Senior input and output ?

I guess I don't have to do file input and output anyways...The CCC people will do it for you, you don't have to do anything special on your own end.

So i guess that's the end of this thread.

Smile Thanks for the help tony and a.j. Smile.

Author:  A.J [ Fri Mar 14, 2008 11:39 am ]
Post subject:  Re: How to do CCC Senior input and output ?

you're welcome!!!!
(P.S:I like the violin dude BooHoo Laughing )
HAPPY PI DAY!!!!

Author:  Tony [ Fri Mar 14, 2008 12:00 pm ]
Post subject:  Re: How to do CCC Senior input and output ?

nike52 @ Fri Mar 14, 2008 10:22 am wrote:
you don't have to do anything special on your own end.

It's a good idea to actually test your code before submitting it.


: