======C/C++ Programming Journal======
=== August 29, 2014 (week one) ===
The first week of classes are over :-o. This semester is going to require a lot **more attention** during classes and **studying** on top of working. Programming is not a simple thing to learn. Matt expressed it perfectly when he compared programming language to foreign languages! Sure you may be able to learn some quick pointers but to be able to put it all together with being sloppy takes time and knowledge. I'm hoping that taking //''C/C++''// along with //''Object and Structure''// class at the same time won't be a problem. I see a lot of similarities already mainly when at the lab section on C/C++. Joe was using a lot of the vocabulary and motions Matt took the previous days. Setting up the repositories along with cloning randomly type coded was interesting to learn but I would be lying if I wasn't confused. Just one misplaced character can completely defeat what you are trying to accomplish. I'm hoping the next couple weeks are not so much easier but clearer to me so I can not feel so lost and begin to gain some confidence that I can do programming and do it well!
__Guide to setting up chat:__
* irssi
* /server irc
* /join csci or lab46
* Alt 1- go to commands, Alt 2- csci, Alt 3, lab 46
* Ctrl+A then D- detach from chat
* Screen -r- reattach
=== September 4, 2014 (week two)===
The second week of class is over and went smoother then the last. I'm still having a hard time once in awhile remembering how to open files and compile the files. However I know in time these actions will become second nature. Matt went over the code we wrote Tuesday. He explained more of the functions as well as altering the program to show us what certain functions do.
__File actions__
* open/create file- nano filename
* compile- gcc -o filename filename.c
* bring up program- ./filename
__Notes__
* 73- integer (set number)(int)
* 3.14- float (irrational)
* 'r','c','d','w'- character (single)(char)
* "hello"- array of characters (string)
* \0- null terminal used at end of string
* Pointer- *
* %p-displays the address of the variable
* %d- used for a signed integer (sign is the ability to go below zero)
* %u- used for a unsigned integer (can't go below zero)(fixed storage)
* d=&c sets d to the same storage set as c
* 0x3D- hexidecimal
* 073- base number
* %x or %X- 4 bytes hex value
* %c- displays as an acii table (asciitable.com)
=== September 11, 2014 (week three)===
**__status cprog__ will show attendance, opus, and projects**
Scanf()
* must leave the \n new line identifier out
* first perimeter type the data type you intend to scan
* next perimeter you would use the & operator to assign the scanned info to a variable
F0r()
* loop
* good for counting
Place holders
* int (integer values) uses %d
* float (floating point values) uses %f
* char (single character values) uses %c
* character strings (arrays of characters, discussed later) use %s
Array
* specify a variable that can be indexed
* helps us be lazy/efficient so that we can write one code for changing variables instead of writing each one out seperately
=== September 18, 2014 (week four)===
Mental Math
* 65^2==> 5^2=__25__ 6(6+1)=__42__==> 4225
* 32x11==> __3__ (3+2)=__5__ __2__==> 352
* 100000-72386==> 7+2=__9__ 2+7=__9__ 3+6=__9__.....==>27614
Coding shortcuts
* i=i+1 ==> i++; or ++i;
* i=i-1 ==> i--; or --i;
=== September 25, 2014 (week five)===
Basecounterflex led up to data types and ranges, see helper.c program. Shows the value of the different variables.
signed and unsigned variables are 8 bits
bits unsigned signed
000 0 +0
001 1 +1
010 2 +2
011 3 +3
100 4 -4
101 5 -3
110 6 -2
111 7 -1
__signed__
* 0 = positive
* 1 = negative
* two's complement- inverting the number and adding one
* char- -128 till 127
* %hd
__unsigned__
* 0-7
* char- 0-255
* %hu
__Programs__
* shortint.c
* shortint2.c
__Logic__
* &-bitwise AND
* |- bitwise inclusive OR
* ^- bitwise exclusive OR
**Day of week program assigned due October 1**
=== October 2, 2014 (week six)===
__Makefile__
- collection of actions instructing Make how to perform the action.
- make help to bring up actions
- use "make" to make things
__CMD arguements__
* argc- argument counter (at least one)
* argv- argument vector, an array of strings
* first argument must be int, second must be char
__Program__
* CLA.c
* funtion.c
__Pipe Math assignment__
* running/creating one of each program (numbers, maths, bases)
* scan for input but doesn't have to be user guided
* coverts ascii to number using atoi(3), value=atoi(argv[1]);
* cd pipemath to access files
Numbers- 4,
Maths- divideby,
Bases- tobase7
__If statement vs Else if statement__
* if else will stop once one of the statements become true
* if statements will continue to run throughout the whole process even if first statement was true
* Else is more efficient for CPU usage
__Readability vs write-ability__
* Readability helps you use less comments because the code is organized in a way the reader can tell the steps
* write-ability involves more comments due to the need of explaining most the steps
* functions are more readability action, can be broken down to make it easier to understand
=== October 9, 2014 (week seven)===
switch (variable)
* may be more useful then if, else if, else functions.
* Used for exact values.
* not really needed but good to know
{
case0:
thing;
break; \\need break otherwise it keeps going case to case until a break
case 1:
thing;
break;
}
__Program__
* funwithgraphics.c
__Pipe Math Assignment__
* now moved to October 22
* plus adding an enhancement to base counting
Gather notes from 10/9 (Thursday class)
=== October 24, 2014 (week eight) ===
__Scope__
* Global- seen by all funtions
* Local- within a certain function
__Function__
* name
* return type
* data type
__Program__
* functions.c
**Knowledge test on October 30**
=== October 30, 2014 (week nine) ===
What we can do with files?
* open
* read
* write
* append
* create
* remove/delete
* seek
__Things to remember__
* fopen returns a pointer,address, to the file
* know what you want to do with your files (read, write, read & write, etc.)
__File pointers__
* stdin
* stdout
* stderr
__Programs__
* funwithfiles.c
* funwithfiles2.c
* datafile.txt
**Skill assessment Thursday!**
=== November 6, 2014 (week ten) ===
__Access Control__
* public -accessible outside the class (like a struct)
* private -can't use until we get to inheritance (later in semester)
* private -accessed only from within the class
__Function overloading__
* allows for functions to share the same name as long as some part, like return type or its parameters, differ.
__ Instantiation__
* creating an instance of a class
* if there is a constructor, upon instantiation, that constructor will run.
__Destructor__
* freeing up resources allocated to an object when an object goes out of scope or is explicitly released.
__compile C++ programs__
* g++ -o filename filename.cc
accessor methods
* allows us to control the private class data
__Program__
* rectangle.cc
* rectangle2.cc
__Inheritance__
* inheritancenotes.cc
=== November 13, 2014 (week eleven) ===
__Programs__
* Directory: SinglyLinkedNode
* create.cc
* create.o
* libSinglyLinkedNode.a
* next.cc
* next.o
* Directory: Node
* create.cc
* create.o
* libnode.a
* value.cc
* value.o
* Directory: inc
* SinglyLinkedNode.h
* node.h
* Directory: src/cprog
* nodefun.cc
__Node.h__
start -> 7 -> NULL [start = new SingliyLinkedNode (7)]
tmp/tmp2 -> NULL
start -> 7 -> 39 -> NULL [start -> setnext (SinglyLinkedNode (39)]
start -> 7 -> 39 -> NULL [tmp=start-> getNext()]
^
'-tmp
tmp2-> 73 -> NULL [tmp2 = newSingliyLinkedNode (73)] (separate nodes atm)
tmp2
'
start-> 7 -> 39 -> NULL
^
'-tmp
tmp2
'
start -> 7 -> 73 -> 39 -> NULL [start-> setNext(tmp2);]
^
'-tmp
Compiling: g++ -o nodefun nodefun.cc -Iinc -LSinglyLinkedNode -lSinglyLinkedNode -Lnode
-lnode
__Reminder__
* -L links to directory
* -l links to the library
* upper and lower case sensitive
=== November 20, 2014 (week twelve) ===
__Program__
* graphicsbreak2.c
* myfile.png