January ?, 2014 – February 21st, 2014 cont. cont.

Guuugh!! I’ve been so busy and sleepy I’ve had to divide this post in three!!! I hope this is the last one w/ this subject! 

But before we move on… Guess what?! I got a 97% On my first comp3010 lab!!!! AWww! I’m so happy!! I hope I can keep it up!

O.k so in the last post we learned that if A is True and B is false and we use && to compare them then A&&B is false because one of them is false however if we use || it’ll be true because you get to pick one of the two (|| = or)

So now’s a good time for all of you to know that there’s a difference between expression and statement. An expression has a value. A statement doesn’t evaluate. ——Well that’s what I have in my notes. Ehhhhhhhhhh?

So after this class was over I went to the profs office and I learned a little bit more about debugging because I had so many questions! First of all I wasn’t compiling my programs for debugging. I was compiling like this: g++ -Wall -o blah blah.cpp

But if I want to compile for debugging I have to use this: g++ -Wall -g -o blah blah.cpp

February 16, 2013

3 is assigned to x

The assignment is an expression value whose expression is 3.

W0w! That was basically all I wrote that day… Shame on me. Aside that I wrote that -= is a decrement.

February 19, 2014

If you want to increment by 1 do this:

count += 1


count ++

If you want to do this: balance = balance + 0.02 * balance

You can also do this: balance += 0.02 * balance 

This is n example of how those shorthand operators work.

mnemonic value = it tells you the purpose. Like a name constant.

So now we talk about constants. If you want to have a constant value instead of one that varies you need to use const for example:

const int maxroomcapacity = 100;

Const is the keyword to declare a constant. Its value cannot be changed by the program like a variable.

At the end of each section we get a bunch of questions. Here’s a sample!! 🙂

1. What are the benefits of comments in a program? They make the program more readable.

2. Can programs modify the value of a constant? NO!

3. Indenting and blank lines, why? They’re important for organization.

I’m pretty sure that’s where that class ended but again! I did not write the next date…

Anyway. We already talked about ! But I have a better explanation for this negation symbol. Logic negation turns what was true to false and what was false to true.

So far we’re already in chapter 3 in the class but I haven’t read it that upsets me… I was looking at the slides for chapter 3 right now if I had read the chapter before these posts would be a lot better~….

Anyway… know that short-circuit evaluation starts from the left and goes on. It is uused to prevent run time errors like n/0.

February 21st, 2014

The opposite of less than (<) is greater or equal.

This day we did a little program for the number guessing game! Yay! It went something like this:

if (number < guess)

 cout << “Too high\n”;

else if (number > guess)

cout << “Too low\n”;

else if (number == guess)

cout << “Right on\n”

But then the prof made us realize that there is no point in testing for number == guess because with the > and < you already have no other option for that else. So the last line will look like this instead:

else//(number == guess)

cout << “Right on\n”

Then we talked about function declaration but I don’t get it very well yet so if I end up understanding it and feel like blogging about it I will. 🙂 Bye for now!!!



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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s