Friday, January 9, 2009

C++: The lab

So far I have had two days of lab (aka we go and work on the computers with the C++ program to make our own programs). The first day was much better than the class part. Being able to apply the confusing lessons helped them make sense. I say the first day, because the second day of class was easier for me to swallow. In general, though, the labs make the concepts clearer.

I'm avoiding actually putting a lab question on here because I'm afraid. If I put, say, practice problems that Rockwell made up on this blog, is that illegal (the paper did have a copyright symbol in it)? Would they fine me 10 billion dollars for disclosing such precious information? I'm not sure, but I am not willing to take that risk. So I'll just go and speak in general terms that anyone would need to know to work with C++.

Here are a few examples of computer lingo. By no means are these incredibly complicated terms (well, I think they're confusing, but according to the computer world these are baby steps. I hope you agree with me). Such lingo is bolded, the explanation is not.

  1. //the example anything you put after those two dashes (which don't look bolded) isn't processed as part of the program- you could use this if you want to give your new portion of a program a clear title so you remember what it is (say, if you don't like the way one part of your program is running. It's easier to find what you want to change if it has a logical name)

  2. cout<<"What is your name?"endl; the 'cout' means that your program is displaying 'What is your name?' on the screen for the user of your program to see (hence the 'out'). the endl means you want that line to end, and the semi-colon signals to the computer that it's time for a new section of the program

  3. cin<< firstName the 'cin' means your program is taking in the first name of the person (said person must type it in, of course). The computer understands the 'firstName' represents a word as opposed to a number because you would define it earlier in your program)

  4. return 0; You have to put this once you are done with any program. I'm not sure why, but this ensures your program will run correctly

And that's all I'm going to tell you. There is much, much more, but I'm not sure how much sense I made explaining those four. My head is spinning just trying to think of good ways to explain them. That being said should prove to you one thing: actually working with this stuff is really the only way to learn it.

This screen shot has some cout's, //'s on it, if you wanted to see what this type of stuff looks like (which I know you do, so you're welcome).

No comments: