A lot has happened it’s time to blog about it!

♫♪Oops! I did it again!♪♫ I missed a week without blogging!!! WHAT IS WRONG WITH ME?!?!?! I know what’s wrong: I’m BUSY! Very busy. But I REALLY WANTED to blog last week… 

O.k let’s begin! First of all: Good news! I’ve completed a whole notebook for this class and now I’m on the second one. Yeah, it’s full of my Pseudo code and my code for all the labs. However I didn’t get a new one ’cause I didn’t feel like buying a notebook so now I’m using my old Physics lab notebook to take my trusty Comp notes! It’s fun because I’m taking mah favorite class while when I flip through the pages I see things that remind me other fun times~♪.

And now: Sad news……………. 😥  I was NOT able to finish lab 5!!!!!!!! The horror! The trauma! The drama!!!!!!! NOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!! HOW COULD THIS HAPPEN?!?!?! I’ll tell you the story from the very beginning. 

It was time to start working on lab 5, the professor warned us to start early. I tried. (Did not succeed much). I asked about problem 5 in class. He gave us a very DECENT and EXPLICIT explanation of what needed to be done and lots of hints and yet I NEVER got one of the loops in one of the functions RIGHT!!!!!!! The deadline arrived, I was VERY tired: I submitted lab 5 the way it was. I was like: “What do?”. There was not much I could do. My brain wasn’t working right… But of course! I was NOT going to give up that easily! The morning after the deadline I went to the prof’s office to see if I could get some help. He gave me some ideas but… I went home I tried to work on it I had all sorts of ideas and I indeed wrote them in Pseudo code. But all to no avail… I got stuck AGAIN! The problem was still wrong……. Next Wednesday I go to his office again, I show him my driver program. It’s better than before so he starts fixing things and telling me a whole bunch of things. Then we run it, but it’s still WRONG! He tells me it’s because of the bad structure of the loop and that I should try again. I go home after a LONG DEPRESSING (depressing 4 other reasons, lol) day and I say to myself: “Shirley, you already got a 60 on Food Chemistry because you were working on these labs instead of studying for what you’re majoring in. I think we both know it’s time to forget about the puzzlers and study for Organic Chemistry because you have five tests and a Quiz next week and you haven’t looked at chapter 20 from Organic Chemistry and YOU know that class needs dedication too. (Pff not that there’s a class that doesn’t NEED dedication).” So after this inner journey I decided it was time to forget about it and I’ve done decent progress after I gave up. Now I’m moving on with other things related to other classes and with even this same class. Today I read chapter six. It was confusing and I have questions but soon I’ll blog about this chapter and I know it’ll help me sort things out in my head. I’m also doing this blog entry which is very important. I finished other things too, blah. Now I have to start working on lab 6 because the deadline is right there on my FACE! And during the week I won’t have much time and I have to make the most out of the prof’s office hours on Monday and Wednesday. Sadly he won’t have office hrs on Friday because we don’t class this Friday because of Las Justas (which is a thing were all the rapists and athletes go to and get drunk and drugged so you obviously won’t see me there. Why the heck would I put myself in danger? People are SO dumb. Just saying… I mean people die and get raped there EVERY year, come on, get real!)

As for the test…… well one of the tests I have next week (which are actually 4 because one of the prof’s changed hers, thank God!) is the second midterm for this class so I have to study for that. A LOT. And I will. Anyway I’ve made a decision: I will leave this blog up to here. This was a story post. A story about lab 5. But I’ll make another post about my notes and analysis of them. I don’t want the posts to be Soooo retardedly long because it gets boring I guess! But before I leave, I will copy paste lab 5’s 5th problem so you can all SEE the level of difficulty. Lol, jkg apparently I was one of the very few who couldn’t do that problem… Everyone else managed to solve it. Ooooooooh……….. I guess I’m the dumb one in class……..

Problem 5! (Read it, it has a story. It’s basically retarder. lol):

Problem 5 In the land of Puzzlevania, Aaron, Bob, and Charlie had an argument over
which one of them was the greatest puzzler of all time. To end the argument once and for
all, they agreed on a duel to the death. Aaron is a poor shooter and only hits his target
with a probability of 1/3. Bob is a bit better and hits his target with a probability of
1/2. Charlie is an expert marksman and never misses. A hit means a kill and the person
hit drops out of the duel.
To compensate for the inequities in their marksmanship skills, it is decided that the
contestants would fire in turns starting with Aaron, followed by Bob, and then by Charlie.
The cycle would repeat until there was one man standing. And that man would be
remembered as the greatest puzzler of all time.
(a)Write a function to simulate a single shot. It should use the following declaration:
void shoot(bool& torgetAlive, double accuracy);
This would simulate someone shooting at targetAlive with the given accuracy by
generating a random number between 0 and 1. If the random number is less than accuracy, then the target is hit and targetAlive should be set to false. Appendix
A illustrates how to generate random numbers.
For example, if Bob is shooting at Charlie, this could be invoked as:
shoot(charlieAlive, 0.5);
Here, charlieAlive is a Boolean variable that indicates if Charlie is alive. Test your
function using a driver program before moving on to the next step.
(b) An obvious strategy is for each man to shoot at the most accurate shooter still alive
on the grounds that this shooter is the deadliest and has the best chance of hitting
back. Write a second function named startDuel that uses the shoot function to
simulate an entire duel using this strategy. It should loop until only one contestant
is left, invoking the shoot function with the proper target and probability of hitting
the target according to who is shooting. The function should return a variable that
indicates who won the duel.
(c) In your main function, invoke the startDuel function 1,000 times in a loop, keeping
track of how many times each contestant wins. Output the probability that each
contestant will win when everyone uses the strategy of shooting at the most accurate
shooter left alive.
(d)A counter-intuitive strategy is for Aaron to intentionally miss on his first shot. Thereafter,
everyone uses the strategy of shooting at the most accurate shooter left alive.
This strategy means that Aaron is guaranteed to live past the first round, since Bob
and Charlie will fire at each other. Modify the program to accommodate this new
strategy and output the probability of winning for each contestant.

=========================================================================================================

Now I’ll show you my loops! Actually I would show them to you but I have them on my virtual box and I can’t copy paste to Windows. B.O.R.I.N.G. Still, I love my virtual box! Don’t know what I would do without it.

 

Advertisements

March 17, 2014 –

O.k I’m back! I ddidn’t finish yesterday ’cause I was tired, hehehe.

So there are two global things we have to keep in mind. Global constants (apparently I’ll have to use that on lab 5) and Global variables. The prof told us not to use the latter. They are a bad idea.

Global constants are constants available to more than one function. So they are not declared inside any function body but outside. Even outside of int main. I found this weird. I guess it’s because I always saw int main a huge thing that blah blah, things you know. But now I’m over it, lol. Anyway these have to be declared before before any function that uses it so it’ll work.

Global variable are basically declared the same way and are available for many functions but the reason why they are not a good idea is that they programs difficult to understand/read/maintain. It is for this reason that they are seldom used.

Another interesting thing we covered in class was Overloading functions, I think it’s a tad confusing… I’m not sure if I would like to overload functions… Anyway this overloading is when you provide more than one declaration and definition using the same function name. The slides says they are very convenient when the same func is needed for diff numbers or types (like double and int) of arguments. Eh, I guess I’m starting to get how this could work. This is why I love blogging about this class!!! I wish we had to make a blog for every single class. But that would take waaaaaaaaay too much time I guess.

O.k, other important concepts from chapter 4 are the black box!

Image

 

This pic basically explains what it is.When you design a function you have to do it in a way that whoever reads it doesn’t have to know how it is done but clearly sees the result of it something like that. You hide information so that the function can be used without knowing how it is coded. The pic does a better job than me at explaining this, lol. A term closely related to black boxes is procedural abstraction. Which can be defined word by word. Procedure is a set of function like instructions and abstraction, in programming, is when you abstract away the code. So when you do procedural abstraction in functions you just do the black box. The function can be used without knowing how it does its thing. Egh.. I’m a tad confused. Procedural abstraction sounds like it = black box…

Top down design: it is the same as stepwise refinement. You start with a small description of what your program will do then you break it into tasks and then tasks within those tasks. It sounds pretty amazing and I understand this is obviously part of the problem solving Phase. So I guess this is done is Pseudocode. Or is part of it.

After all of this we started with Chapter 5: Functions for all subtasks.

A datatype defines a set of values and operations allowed on those variables, right? Well now we begin with a very peculiar/confusing new data type……… VOID. A.K.A THE EMPTY TYPE. Why? Because it has no values and because of it there are no operations. I still fail to get the point of this type. But I know I will when I decide to blow my mind with lab 5. A void function return NOTHING!!! But it has its things that it can do. For example we can cout from this function. But then again I understand we could do that w/ the other func as well.

So this girl suddenly made an interesting question this day that we took this class. She was like why return 0? Can’t we return 1? I had wondered the same thing for a while. The prof said that we could return whatever but f we don’t return 0 (at the end of our progs) then we can’t use them as building blocks for [wait I didn’t write what we can’t use them as building blocks for, lol. But I think it was] bigger programS?

So the thing is that with void functions you don’t always need to write return at the end of said func. You only need it when you need to return above in your program.

So an expression has a value but a statement is a side effect. It does not have a value. That is the diff between those two. Just saying. But you can use an expression where a statement is expected.

Ugh. Now we start with call by reference parameters. Call by value can’t be used for EVERYTHING so we use call by reference in those cases. After the prof said these things he went on to give us a very complicated example about how if you want to switch the value of a var w/ another you can’t use call by value. But then you use the ampersand symbol and you give the function? access to the variable and it works and that’s called call by ref. 

 

Image

 

I have here the ampersand is a specification of the parameter passing. Hmm i guess that explains the acess thing. Anyway I have to go to class so I’m leaving!! Bye!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

AAAAAAAAAAAAAAAAAAAAAAAAAAAAh!!! Believe it! I skipped a WEEK without making a POST!!!!!!!!!!!! How irresponsible of me! But I had good reasons. I was super busy failing tests. I always have all my tests in a row. Which is extremely dumb because my brain can’t process so much. But, oh well! The date is not up to me sooo…….. 

Let’s get started! Last week I was reeeeeeally busy wirth lab 4 so……… Hmph… Oh and I have to get started on 5 asap. But I must read chapter 5 first. That’s how I roll. I always read the chapter before I start the lab. Luckily these chapters don’t take me that much. I just took a Physical Chem test and guess how many chapters I read? one out of FOUR!!! BECAUSE they take me SO MUCH TIME I CAN NEVER FINISH!!!!!!!!!!!!!!!!!!!!!!!!!!! But these chapters are nice! I can finish them in one day. 

Once again I’m not writing the dates on my notes so I’ll just write about the latest things we’ve been taught. So until yesterday we were on chapter 4. Chapter 4 is ALL about functions. So we talked about parameters. And what are parameters? Well it’s a name you find on the function declaration. The slides liken parameters to place holders but the prof told us not to think of the as that. But to think of them as assignments. I know. I said this last time I just noticed. Since I already talked about this I’ll go on with parameters, their names have to convey the variables they will represent. For example if you have a program that calculates something but to get something you need a whole bunch of other somethings then your function declaration would look like this: something_func(int something_a, double something_b, string something_c). The parameters need to have names that match the variable names you’ll be using when you make the function call so you won’t get confused but otherwise you can name them whatever you want and it’ll still work… The slides call them formal parameters, but why formal? I’m not sure but I think it’s to distinguish from void. Which is something we’ll be discussing later. Something that I don’t get very well yet…….. Going back to parameters, names have to convey because that way there won’t be any clashes if you use the same parameter name in diff functions. This is completely true because sometimes you need to use the same things on diff funcs and if the par names convey what they represent then you can just name them all the same way and it wont be a problem really.This involves programming decisions! And we are making them!! 

Now the next thing we talked about on my notes was Pseudo code and I really liked this part so I’ll expand. According to the slides Pseudocode is a mixture of English (or any other human language) and the programming language in use. Pseudocode simplifies algorithm design by allowing you to ignore the specific syntax of the programming language as you work out the details of the algorithm. The slides also mention that if the step is obvious, we use C++ to write it down and that if it’s difficult we use English or any other…

But the prof gave us better advice. He told us to avoid making it look like C++, why? Because Pseudocode frees your mind. He says Pseudocode MUST be freestyle to allow your creative power to flow freely! After his powerful words I’m starting to look at program like some kind of BEAUTIFUL art. You know cause art = creativity. Anyway the thing is that you don’t want to restrict yourself thinking about: “How do I write this in C++?”. No ’cause how are you going to know what to write if you haven’t solved the problem?! Anything is allowed in Pseudocode, I will now present you some examples of what my Pseudocode looks like and what they are:

drawings:

Image

These were some little drawings I made for Problem 4 from lab 4. This was the most challenging yet fun problem. It was great because it was about time travelling and I L.O.V.E that topic! (I know…… it’s impossible!!! Still fun!) Anyway, the first time I did the problem it was completely wrong and I had a hunch so I showed it to the prof and he gave me SOME MYSTERIOUS LEADS and reasons! Then I left his office because his office hours were over and because I can’t think very straight with people around me… I’ve said this before… But then when I got “home” and sat on the sofa, it HIT me!!!!!!!!! I just have to add 24hours when the result is negative!! And I was so happy I got to writing Pseudo code to see if it would work and when I did this I realized I was missing more details and corrections on my source code if I wanted to get the right difference between future and present time!

 

Another thing you can do in Pseudo code is scribbles:

 Image

ImageThe wording of this problem was difficult so I had to do these arrows showing what I was going to use to calculate things, I’m not sure if I got it right in the end… I feel like I did lab 4 in a hurry… blaugh…………………… Uuuurrr.. I’ll prolly end up doing the same w/ lab 5……………………………… I only have one more week to go before it’s due…………………

More scribbles (literal scribble):

 

Image

Math, human language & other:

Image

Image

 

 

Image

Image

 

O.k! Yay! Enough Pseudo code.

Piece of advice from prof: Learn to estimate. You can test whether some output is plausible w/ estimation. Estimation is the key!!! Why do I suck at it then??? Urgh..

Anyway… This is it for today! I’ll prolly write more tomorrow! Bye!!!!!!! 

My grade!!!!!!!!!!!!!!!!!!!

I PASSED!!!!!!!!!!!!!!!!!! Remember I said I was about to take my first Comp3010 midterm? Well  PASSED!!!!!!!!!!!!!!!!!!! My dream was to get an A but instead I got an 89% which is almost an A! Almost so it means I’m not good enough but at least it wasn’t an F!!! For some reason I thought I was getting an F on that test ’cause I didn’t quite understand the first program presented on the test but even so I was able to answer one out of three of those questions right! With the power of the bonds of reasoning!!!!!!! And the rest of the test was perfect ’cause I got all the points in all the parts. Hurrah!! Oh well thanks to those 2 questions I lost 11pts and therefore got an 89%… But still I’m super happy! I ranked 6/68 and I never really win anything so I’m super happy! Plus believe it or not I rank first in many of the quizzes. These are things I can’t believe! But I AM SOOOOOOO grateful!!!!!!! I only got a B because everyone was so nice and helped me understand the material so much. The professor with his office hours and Emmanuelle always spending his time on helping me get things, although he is SOOOOOO busy!! Ooooh the kindness!!!!!!! It makes me wanna cry!!! Also other people helped me like Rick and Alexander and his friend… EVERYONE!!!!!! Oooh the feels!!!!!!!

 

Image

 

But still, my goal is to get an A on this class!!!!!!!! I always go for an A!!!!!!! I Only like A’s!!!!!!!!! Because I like doing my best you know! Hahaha!

Now let’s get down to a SEVERE problem I have and have always had and embarrasses me. I can’t do mental calculations very well only if I’m alone or if I ask myself the question. But when other people ask me I get super nervous and can’t answer so I just start saying random numbers to answer very quickly or don’t say anything at all!!!!!!!!!!!!!! The prof noticed. He told me to calm down and that I would get it right if I did. A few days later he asks me the remainder of 14/5 we all know it’s 4 but I freaked out and started looking at my papers and some kid that was sitting next to me said it!!!!!!!!!!! I needed a freaking BREAK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! I WANTED TO SAY IT!!!!!!!!!!!!!!!!! AAAARGH!!! And because I’m SOOOOOO AWARE of this FREAKING problem many years ago I got an app that asks you a lot of silly math questions like that one so I could practice my mental calculations and when I use it I get all the answers right but if someone asks then I GET STUPID!!!!! So the App helped me with NOTHING! Well I guess it did since I used to be terrible at mental calculation even in my head, lol. I just like to see everything on paper!!!!!!!!!!!!!! Guuuuh. No one would ever believe that I love math and passed all my Calculus classes with A…. (But then again through all my previous college years the calculator had always been my best friend… Shame on me). I AM A SHAME TO MATH!!!!!!!!!!!!! Just kill me………. Oh hey! I remember the first day of class the prof said we could use this blog to vent our anger at the class I just did!! Except that I’m not mad at the class I’m just mad at myself for failing so much at simple mental calculations needed in programming and everyday life. Ugh! But oh well might as well get over it. 

So after a test I sometimes feel everything is over and that at last I can breath but then I face reality when I go to the classroom and the prof has already begun with a chapter that I have yet to read and then the cycle repeats itself. Silly Shirley behind in all her classes…. ESPECIALLY PHYSICAL CHEMSITRY, so behind…………………………………… 

So with that I’m saying we already started chapter 4 on March 7th. I didn’t take that many notes but if there was something I did take was only 4 lines in my notebook, lol. Great job concentrating Shirley. Nah I’ve actually noticed that if I read the chapter before hand then everything is clear and I can pay attention but if not, whoops…

So anyway, function call  sqrt(9.0)

something about functions in math and positions

library = machine code files

type casting, try avoiding it if you can. 

That was it people. Well see ya! Off to study for organic chem and attempt other things!!!!!!!!!!!!!! 🙂

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!!!!!!!!!!!!!!!

 

Accepted!!!

Accepted!!!

Weeeeeeeeeeeeeeeeeeeeeeeeee!!!!!!!!! Happiness!!!! So! I finally tried submitting another COJ problem and this time they accepted my problem right away!!!!!!! Ooooooh!! I’m SOOOOO happy and yet SURPRISED!!! Because I was sooooooooo expecting it to be rejected! Reason????? The compiler kept giving me a warning message and the book says that newbies MUST take warning messages as error messages. But to be honest every time I get a warning I honestly feel like running the program anyway to see what happens but I never do. What I do is that I go back to emacs and end up finding a ton of errors… lol.

This time however, I could find NO error so I ran the program and realized it was working just fine. The warning message kept telling me that the variable n was unused! But I very well know that I was indeed using n. So although I was afraid I decided to let the creepy online Judge judge my work. And trust me that Judge is to be feared. My first problem got rejected on my first try and accepted on my second. He is SOOOOO sensitive. But not a real person btw. I understand he’s just a machine. Still… I can see him laughing at all of us, newbies… lol……….

But anyway!! This time my problem got ACCEPTED!!! I’m SOOOO Happy!! And surprised.

Oh and good yet worrisome news! I officially joined ACM, that association I told all of you about, mmmmmmmmmmmhm!!!!!!! Whoops! I just got myself MORE work to do. I haven’t done anything on the association yet though. lol….

Oh BTW the problem I just submitted on coj was sum and I’m planning to do general election next when I have the time! I’ll do all of them!! Hohohoho! My goal was to make a coj prob per week but thT PROVED TO BE FAR TOO CHALLENGING FOR THIS NEWBIE… Whoops –caps— sorry. Anyway! Bye!!!!!!!

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

or 

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!!!