Tuesday, September 28, 2010

Week Two:

Well week two's here and my instructor is just as hard to understand as last week.  I don't even know if I have an American teacher or not this quarter.  It makes me mad that the university hires these people knowing the students won't be able to understand them.

Setting up your program can be a little boring sometimes.  There are a few lines of code that must go at the beginning and end of every program you write.  We haven't learned what it means yet but with my experience I understand what it's doing.

This goes at the beginning of every program: 

#include <iostream>
using namespace std

int main()
{

This goes at the end of every program:

return 0;
}

Anyway, one of the main functions of C++ is the console.  Represented by cin or cout, the commands are used to control a program's input and output.  The correct way to pronounce these words is "see-in" and "see-out".

In a typical program, you may see these console commands in code similar to the following:

cout << "Enter your age.\n";
cin >> user_age


Think of cout as your monitor; when you tell the console to output something it will usually be on your monitor.  The arrows represent the flow of data, i.e. taking the string "Enter your age.\n" and sending it to the monitor to be displayed.  The next line takes the user input from the keyboard and stores that value in the variable "user_age".  Notice the arrows are pointing the other way; think of cin as your keyboard, the arrows then point from the keyboard to the variable.

Well there's plenty more to talk about but I have other classes to work on too so I'll be posting more from this lecture very soon.

P.S. I'll make a program out of the examples I used.

#include <iostream>
using namespace std

int main ()
{
     int user_age, user_bday;
  
     cout << "Enter your age. \n";
     cin >> user_age;
     cout << "you are " << user_age << " years old." << endl;

     return 0;
}

If, for example, the user inputs 20 for user_age, the output will be "you are 20 years old."

Note: "\n" (newline) will cause a line break and the next output will be on a new line.  It can also be replaced with the "<< endl" shown above.

Country-Steak: Sauce

I've been playing a lot of Counter-Strike: Source lately and I'm so addicted it's not even funny.  I suck at it too i just can't stop.  What other games do you guys have for Steam that you would recommend? (bonus points for Valve games cause I have all of them)

May the Best Tablet Win

I thought this article might be worth sharing on here.  Even though I think tablets are stupid, I like to read about them so I can tell other people how stupid they are.

http://gizmodo.com/5649368/ultimate-tablet-showdown-ipad-vs-playbook-vs-galaxy-tab-vs-slate

Monday, September 27, 2010

Week One:

Well I had two lectures last week and they were pretty boring.  We've just been going over the basics that I've heard a million times: how data is stored, how the CPU and RAM communicate, what the compiler does.  None of it is too important and really won't affect your programs at this point.

Basically, the only important thing that I learned is how to log on to the network allowing me to work in a UNIX Command Line environment through SSH Secure Shell.  Since you're reading this you probably aren't taking this class so you will need to find your own IDE.  Eclipse CDT isn't a bad option http://www.eclipse.org/cdt/.

Now that you have your IDE, you're finished with class.  Party hard this weekend :D