You might try starting here:
http://www.robotc.net/content/lego_curr ... urric.html
Look at the link first. It covers the topics you are asking about in a series of tutorials. If you get confused or have questions, feel free to ask.
There's also a bunch of demo programs that come with robotc but since you're new to programming, I'd start with the online curriculum. It should tell you how to do exactly what you're trying to do.