Test AHEAD!!!!!!!!!!!!!!! :0

OMG Guyz!!!!!!!!!!!! Three days ago I recieved two emails that made me smile amidst all the chaos! But I hadn’t had time to blog about it because I’m busy, as always. The two emails were from wordpress telling me two people were following me now!!! My first two followers!! That was SOOOOO UNEXPECTED!!! I never expected to have followers in this blog! And yet I got two!!! Thanks you two!!! You’re such sweeties!!!!! And one of those two also liked one of my posts!!! Awwwwwwww!!! This is so great!!! Thanks!!!

Image

 

You know what makes no sense? That I’m also following myself? How is that so? I don’t recall clicking something to follow myself. Isn’t that weird. Maybe I did something and didn’t notice. But now I shall stop for this has nothing to do with programming and I WILL lose points!! But thanks again guys!!!!

 

Oh GOSH!!!!!!!!!! So like the subject says, MY FIRST PROGRAMMING MIDTERM IS THIS WEDNESDAY!!!!!!!!!!!!!! WHAT DO???!?!!! Me = scared!!!!!!!! Urrr………. We had this practice test and I HAD SO MANY WRONG!!!! The prof helped me at his office hours and I get it now, but HELLO, DUH!!!!!!!! Those questions on the practice test ARE SOOOOO not the same ones that will be coming on the practice test, like D.U.H!!!!!! Urrrr……… So anyway I’ve been practicing a lot doing those online quizzes and all that but still…. Oh and guess what I finally did? The Hello World program. That program is HISTORY!!!!!!!! That’s like EVERYONE’S first program. I’ve already done a bunch of simple yet not as simple programs but I JUST HAD TO DO THAT ONE!!! Even if it was dumb!!! But what I did was that since the program is simple and therefore I was not afraid of it I used the <<endl instead of the \n. I had never used <<endl for some reason I felt uncomfortable with it but I’m starting to feel better about it. This is my tiny source code:

Image

Yay!!! Lifelong dream fullfilled! Ever since I met a guy who was learning to program (he later got tired of it and changed to psychology) and told me the first thing you always do when you learn to program is Hello world I had been wanting to try this!!! And then when we did a first program it was the peas one… But hurrah! ‘Cause it was original! Still did Hello world, uh-huh!

So anyway as yet another practice exercise I will share my latest notes with you all!!!

February 24, 2014

Have you heard of The Switch-Statement? Well guess what? It’s not a loop, because there’s no repetition. It’s an alternative for constructing multi-way branches! And menus go hand in hand with it! You end the statements with “break” so the comp will understand that that statement ended and another one is starting or you can also add a “default” which is an option for when the user types something that isn’t an option. Or at least that’s what I understand it does. But the other day I handed in a program with a switch multway branch and didn’t add a default because I didn’t get why I would do that but now that I’m blogging about it I realize I totally should HAVE!!!!!!!!!!!!!!!!!! Defaults are great!!! Hnnnnnnnnn…. Now I’ll lose points………. Urr…… 

The guidelines for switches:

switch (controlling expression)
{
case Constant_1:
statement_Sequence_1
break;
case Constant_2:
Statement_Sequence_2
break;

case Constant_n:
Statement_Sequence_n
break;
default:
Default_Statement_Sequence

O.k so in programs there are blocks, these are sections of block enclosed in curly braces. If you declare a variable within that block the variable is local to that block so you can use the same variable name outside that block. But why would you do that? it’s confusing.

Uh, yeah….. scope not the same as lifetime, I have that written down… Not sure what it means… *worried lol*

O.k I have this on a slide titled: Scope rule for nested blocks

If a single identifier is declared as a variable in
each of two blocks, one within the other, then
these are two different variables with the same
name
 One of the variables exists only within the inner
block and cannot be accessed outside the inner
block
 The other variable exists only in the outer block and
cannot be accessed in the inner block

I know the word scope can mean space for movement or activity. Applying this definition to what I just pasted from the slide I’m guessing scope is the space in which that variable exists kinda since I also just said is not the same as lifetime. Hmm then scope applied to a variable can mean yeah the space in which the variable acts! Like within a block! 😉  Am I right?

But then again lifetime seems to be the space in which the variable is alive. Hmm so could it be that scope is the action and lifetime the space where the variable is working? Oh man………

Ahahaha! lol I just went to the next pg in my notebook and it says scope = variable exists and is available for all the algorithm.

lifetime = variable is only available within curly braces in which it was declared.

U know what I find hilariously cute? The words curly brace!!! It is like the cutest!!!!!!!!!! 🙂

Oh a variable must be alive to be visible. 

O.k so I guess I was supposed to know this a looooong time ago but I was reading chapter 3 last week and I finally grasped the important difference between do-while and while. It is when the controlling boolean is checked! In a while the boolean is checked before the loop body is executed. In a do-while the body of the loop is executed first and then the boolean is checked. After the loop of the body is executed. 

So why do I say I finally grasped it now? Because I KNEW the do-while always executes at least once but I hadn’t realized that it was because of WHERE the controlling boolean is checked…. Things like these make me realize how I long yet lack common sense…. 😦

lol

oh and guess what? ++number ain’t the same as number++. ++number increases first and then does the rest, if there’s a rest. number++ does other things and then increases by one. Something like that, do you get it?

Wanna know why I’m afraid? Because it’s 6:49 and I’m still at the library now when I go outside it’ll be dark….. my neighborhood = not good…………… oh well. Too late now. lol

sentinel value = one that is somehow distinct from all possible values on the list being read in and so can be used to signal the end of the list. I haven’t used one of these yet so I don’t get it very well yet….

Oooooh! Check this trickery out!

count– – –count. Get it? I did!!! It’s like this (count–) – (–count) but thanks to precedence  rule we don’t have to write the () so it looks all confusing like that. heheh

Oh guess what? Anything a while loop can do can a for.

In a while everything’s scattered in a for everything’s neat. for(initialization; condition; update action). That’s it. No semicolon after the for() or you’ll create empty an empty statement and your for will be over and it won’t do what you want it to do. Unless that’s what you want I guess.

Criteria for which loop to use:

1. If it has to be executed at least once, Do-WHILE!!!!!!!

2. If it doesn’t even have to be executed, for!!!!!!!!!!

***for is only better than while in presentation but guess what? Presentation is a BIG deal!!!

So the other day my friend Emmanuelle taught me a little bit about functions and so did the prof at his office but eh… I’ll blog about it when I read chapter 4….

Oh guess what? Sometimes when your source code is too faulty (or buggy) you gotta throw the whole thing away. But it’s not always the best option. Hahaha! I know I’ve had to throw away the whole thing several things already… heh!

Well see ya everyone!!!!!!!!!!!!!!!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s