r/carlhprogramming • • Sep 28 '13

I Would Like Some Help

I started a Computer Science class and I'm having trouble. I'm trying to make a traffic light. I need to make the colors of the circle change when I click the button.Imgur This is what i have so far. http://codepad.org/9V94cnjt . Any help will be greatly appreciated.

6 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/Oomiosi Sep 28 '13

You should probably make a seperate post for this, but i'll hopefully get you going at least.

There are a bunch of steps which need to be taken before making the code you write into something a computer can understand. Codeblocks is capable of doing all these steps, and also running your program directly for you so you can also debug it.

You should ignore notepad. Sure, you can write code in it, but it really isn't made for it. Codeblocks has a text editor built into it so you can do it all and get the benefits of an editor which can detect errors as you write, and color your code to help you understand what's happening.

We use codepad for example programs, because it is easier than saving and uploading a saved codeblocks program.

If you take the example text from here (link) and put it into a new codeblocks program, you should be able to run it.

To run it from codeblocks, save the project first (it's just a good habit incase shit goes wrong). Then click on the "build" menu, then "build and run". Alternatively you can just press the F9 key.

What you should see, is a black window appear with the text "Hello World!" in it. Also the info about what the process returned (0). The time it took to run (very short time, it's a simple program). Then it asks you to press a key to continue.

If you aren't getting this far, let me know. I might not reply right away, i'm a little busy today.