Err

Friday, February 22

The nights drag. What a drag.
Sent via BlackBerry by AT&T

Monday, February 4

This lesson may or may not be a bit longer. I'm not only going to talk about functions because in this lessons I want to introduce some actual real life coding.

Hopefully you downloaded C++ Express like I mentioned. If you haven't I recommend doing so now (unless you already have some form of Visual C++).

To begin, open Visual C++ Express edition. Click "File", then hover over "New" and select "Project..." A new dialog box will open up which allows you to select what type of project you want to create, the name of the project, and where you want it to be created. Visual Studio automatically creates a directory for keeping all of your projects so I recommend leaving the project location at default. Also, leave the "Create directory for solution" checkbox checked which it should be by default. If it's not checked then check it. Feel free to name the project anything you like, I recommend "CLessons" or something similar.

On the upper half there's a list of options on the left. Click "Win32" and this will open up more options on the right side. Highlight "Win32 Console Application" and then, after making sure you named the project, click "Ok"

After this a ewn dialog box will open. Click "Next" to go to the next page of the dialog. Make sure "Console application" is chosen for "Application type" and check the "Empty project" option under "Additional options"

Click finish and your new project will be created. At this point you should see a list of items on the left in a window called "Solution explorer". You should see the name of your project (ie "CLessons" or whatever you named it) and underneath this three folders named "Header files", "Resource files", and "Source files".

Right click "Source files", hover over "Add" and click "New item..." A new dialog box will open similar to the "New project" dialog. This will be your C++ source file which will contain the code of your project. Name the file whatever you want, but I recommend something like "Main". On the upper half click "Code" on the left hand side and then "C++ File(.cpp)" on the right side. After doing this and naming it click "Add"

Now you have a blank sheet to fill with code. Type the following code in:
int main()
{
int a = 0;
int b;
return 0;
}

After this you can click the run button to build and execute your program. The run button looks like a little green play button on the top toolbar in visual studio. It will ask if you want to build your program so just click "Yes" to have it build your program and run it. This program will do nothing but initialize 2 integers so you'll only see a command prompt window open then immediately close.

Well, I know I said this would be a lesson about functions but I guess it turned out not to be. I'm going to leave this here and explain what's going on next lesson. Ok, on second thought I'm going to stop saying what I'm going to do next lesson because I usually end up changing. See you next lesson!

Sunday, February 3

damn blog!!! why dont you display the timestamp!!!! rattin fattin varmit!
this blog is hardcore nothing.
you know, this stomach virus or whatever it is is really kickin my ass
so i woke up an hour earlier today at 230am.
and its 6 hours later at 8am.
you know ive had 6 craps so far??????
crazy i know.

lets get away from that topic.
so what?
i watched across thte universe.
think grease with beatles
and war
and hippies
and bono on LSD trip.

it was pretty good.
but i <3 musicals zomg!

hahahaha heres dj assault again
this is just a funny song.
"bi sexual bitches that do their friends...i love yall ho's for letting assault join in"
some iconic dj/rapper combination who is seemingly promiscious, likes bi sexual women. who are equally promiscious.
lovely

duuuude
i slept so much better last night
i laid down at 845pm.
on a saturday night
yes i know
there might have been a time
when id have been out
doing things
but man
i couldnt wait to lay down
and sleeeeeep
its a good feeling.
or an old feeling.
growing up is something easy to do
maturity...ahahahahaha...there's the rub.
since my main defense for fighting with my son is "well he started it" i suppose there is less hope than i want.
extreme weather in china!
sucks.
you know what else is extreme.
gabes mom.
UNGH!

let me go off on gabes mom for a bit, since everyone else already has
UNGH!
gabes mom is like a blackberry, multi functional but serves on main purpose, oral input.
UNGH!
gabes mom is like an STD, sucks having, but you did it anyways!
UNGH!
gabes mom is NOT like this blog, which no one sees!
UNGH!
gabes mom is like myspace, she has space for everyone
UNGH!
gabes mom is like my lower intestine, really tore up right now!
UNGH!




eeeee
sorry gabe!

i have to go to the restroom
again.
sigh.
i should go home early.

Saturday, February 2

This is a tinier lesson that's a bit of a continuation from the last one. A variable's scope is where the variable can be "seen" by other parts of the program.

Let's say we have some nested blocks of code such as this:

{
    int a;
    {
        int b;
        b = a;
    }
    a = b; //Error
}



Blocks of code get "nested." Developers usually show this nesting visually by indenting blocks of code like I've done here. Basically, variables can be seen only by the block of code it's declared in and any blocks nested within the block it was declared in. As you can see in my example the block of code that b is declared in can see a because it's nested within the block a was declared in. The line below that block of code produces an error however because b can't be seen by blocks of code "higher" then the block it was declared in.

The reason for this is that when the end of a block of code is reached any declared variables are discarded and forgotten. In the above example the end of the block the b was declared in was reached and therefore b is discared and forgotten. When a then tries to get b's value the program no longer knows what b is.

Next I'll begin on functions, but at this point you should download the free "Visual C++ Express" from http://www.microsoft.com/express/download/. I'm going to begin teaching from hands-on examples rather than keeping this abstract.

Friday, February 1

Did anyone read or get anything out of my C++ lessons? If so I'll continue them