470,870 Members | 996 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Share your developer knowledge by writing an article on Bytes.

Class 1: So You Wanna Learn Programming... (In C++)

9,065 Expert Mod 8TB
Posted by Ganon11

So, you want to learn how to program! Good for you! Programming is a very intruiging and fun activity to pick up, and it's also a great career choice if you like it! Finally, it can be a great brain teaser-type activity, as you challenge yourself with creative and difficult problems!

But there's a problem.

What I'm typing in right now is English. It's cool, it lets you understand what I'm saying, and we've spoken English all our lives. What I'm GOING to be writing in, however, could be called another language entirely. It's what I (rather uncreatively) call Computer-Talk. You would have no trouble understanding the sentence, "Today I took a walk in the park." But try your hand at understanding, "Access the value at position i of myArray to initialize your variable."


Fortunately, we won't be dealing with anything this weird for a while. Until then, I'm going to be teaching you a little bit about the basics of Computer-Talk - easy things that you may have heard of before, like Variables, or Input. I'm also going to show you a few things that we see in English class or Math class, but mean completely different things when programming. So let's get started!

The very first vocabulary words we have to learn about are the basics of any language. You have to know what I'm talking about when I ask you to write some programs. Writing programs is called coding, since we are writing code that the computer will be able to understand. Once we finish our beautiful programs, we have to turn them into something the computer can understand. In order to do this, we use a compiler. A compiler can also be a program that helps you to code. For example, I use Bloodshed Dev C++. Not only does this let me compile and run my programs, but it will recognize certain keywords and highlight, change color, or embold them so that I can see important things more easily. This type of compiler is called an Integrated Design Environment, or IDE, because it is an environment that is friendly to us while we design our program. Cool, yeah?

All right, down to some hardcore programming terms. The most important thing to learn for a beginner is input and output. When you ask the user (that's whoever will be running your finished program) for some value that will change the way your program runs, that's called input. In other words, the user is inputting a value. For example, suppose you made a guessing game in which your program generates a random number and the user tries to guess it. Well, in order to do this, you need to be able to get the value, right? Right. That's input.

Output is even simpler. Any program you run has results. You click a button: something appears on the screen. You move: it plays a sound. The moniter and speakers are both output devices - they are a way for the computer to communicate with you. Our output will be very simple, consisting mainly of words appearing in a text box, but it is still vital. Output will help you to determine what your program does. For example, in the guessing game, your program needs to tell the user if they have guessed the number or not. It wouldn't be a very good program if you didn't let the user know if they won, would it? Output can also be used to determine where your program is NOT working (God forbid!). By placing output statements in critical points, you, the programmer, can say, "All right, I expected this value to be this, but instead it's this. This must have gone wrong," and so on.

The final word on our list of basics is syntax. In English, syntax means "the study of the patterns of formation of sentences and phrases from words." (http://dictionary.reference.com/browse/syntax) For example, I type in a very straightforward manner. But consider Yoda, who would say, "In a very straightforward manner type I." The difference in our speaking style is in syntax. Syntax has a similar meaning in programming. In order for the computer to understand what you type, you have to follow certain rules. These rules will become evident as we learn some real programming terms.

Well, now you know what I mean when I say, "Compile your program and tell me the output." You also know what I mean when I say, "Ask the user for input." But you still don't know any real programming! That will come next time, when I show you the most basic of all programs - Hello World!
Dec 5 '06 #1
7 5477
Nice article. Now i am looking forward little bit more. I know basics of C and C++(OOP). But i like to start professional projects using C and C++. Where from and how shall i start? Would you please help me to build my Dream. Be a C or C++ Professional Programmer. More specifically build myself as professional developer using C/C++.
Dec 25 '07 #2
please written the programmes to understand the listeners (freshers)
Dec 26 '07 #3
thank for resistration
Dec 26 '07 #4
please send reply to me sir............................................... ..
Dec 26 '07 #5
thyank u sir............................................... ................
any way good night sir.........................................
Dec 26 '07 #6
So far it is great. What I'm looking for however, is how to make the columns in the start/programs smaller. In my windows, the first one is so large, it won't let some of the others show in the screen.
Jan 4 '08 #7
Cam you tell me How to make the text color I alway make a mistake all time .
Can i have some form of c++? like syntax .
thank you
Jan 11 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Eric | last post: by
12 posts views Thread by Harry | last post: by
14 posts views Thread by GUSTAVO V. P. | last post: by
reply views Thread by pedaammulu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.