Friday, 12 April 2013

Week eight day 2

Both the increment operator (++) and the decremented operator (--) come in
 two varieties prefix and post fix. The prefix variety is written before the
 variable name (++myAge); the post-fix variety is written after the variable name (myAge++);.

in a simple statemet is doesnt matter which you use but in a complex statement
 when you are incremental or decrements a variable and then assigning the result to
 another variable it doesn't matter

Week eight day one

Learned different cout functions for displaying text
/a      Bell(alert)
/b      form new line
/f       new line
/n       carriage return
/r       tab
/t       vertical tab
/'       single quote
/"      double quote
/?      question mark
//      backslash
/000      octal notation

Thursday, 4 April 2013

week seven day 2

I have moved on to constant functions and classes. Using the keyword 'const' you can make anything in C++ unchangeable which solves a lot of problems for example;
int x = 5 const;
this makes the int X unchangable.

Tuesday, 2 April 2013

Week seven day 1

So far this week I have been working on classes and how they can be used to further shorten the coding process. Using classes is very useful if you are making many things that will need to use the same functions, using a class makes it so you can use any amount of function names as you wish keeping them under the same roof instead of making all new functions when you make a new name. 
for example:

class Cat
{
    public:
       int itsAge;
       int itsWeight;
};

Cat Frisky;
Frisky.itsAge = 10;
Frisky.itsWeight = 100;

Cat Billie;
Billie.itsAge = 2;
Billie.itsWeight = 50;

This is used as you can see to help make it shorter to have all this code instead of writing out all the ints for each 'Cat'.