Thursday, December 30, 2010

C++ Strings

Intro to strings this morning

#include iostream

using namespace std;

int main () {

char buffer[10];

cout << "Type some text and shit" << endl;
//hold space for the null character
cin.getline(buffer,9);

cout << "You typed : " << buffer << endl;

return 0;


}

Wednesday, December 29, 2010

C++ Dynamic Pointers

#include

using namespace std;

int main()
{
//star means its derefrenced
double *myDubPtr = new double;
*myDubPtr = 64;

cout << "*myDubPtr = " << *myDubPtr << endl;
cout << "memAdd = " << myDubPtr << endl;

//delete the memory in the heap, dont use the star, you want to delete the memory address allocation
delete myDubPtr;

return 0;
}

C++ Static Pointers

An example of how pointers work on static variables


#include

using namespace std;

int main()
{

int *ptr;
int x = 64;

//& is the memory address of the variable
ptr = &x;
cout << "ptr = " << ptr << endl;
cout << "x= " << x << endl;
cout << "&x = " << &x << endl;
cout << "*ptr = " << *ptr << endl;


return 0;
}

C++ Header files

header.h files have the function prototypes

#ifndef _SIMPLE_MATH_H_
#define _SIMPLE_MATH_H_


int myfunc1( int x , int y);
int myfunc2( int x , int y);
int myfunc3( int x , int y);
int myfunc4( int x , int y);

#endif

the correspoding header.cpp file contains the body of the functions, it is located in the header file folder

#include "simple_math.h"

int myfunc1( int x , int y) {
return x + y;

}
int myfunc2( int x , int y) {
return x - y;

}

int myfunc3( int x , int y) {
return x * y;

}
int myfunc4( int x , int y) {
return x / y;
}


and an examle of a main.cpp program calling the header files


#include iostream
#include "simple_math.h"

using namespace std;

int main() {

cout << "4+2 =" << myfunc1(4,2) < return 0;
}

Tuesday, December 28, 2010

C++ Functions

#include



int addNum(int x,int y) {
return x+y;
}


int main() {


int numOne;
int numTwo;
std::cout << "Enter Two numbers Please:"; std::cin >> numOne >> numTwo;

int sum = addNum(numOne,numTwo);
std::cout << "The sum of " << numOne << "And " << numTwo <<"is"<< sum << std::endl;

return 0;

}

Thursday, December 23, 2010

0054 Hand Studys

0053 Hand Construction Prac

C ++ Tutorial Loop Structures

#include

using namespace std;

int main () {

cout << "Hello, World! " << endl;

cout << "My For Loop " << endl;

for (int i = 0; i < 6; i++) {
cout << i;
if (i != 5)
cout << ",";
}
cout << endl;


cout << "My While Loop " << endl;

int i = 0;
while ( i < 6) {
cout << i;

if ( i != 5)
cout << ",";
i++;
}
cout << endl;

cout << " My Do-While Loop " << endl;

i = 0;
do {
cout << i;
if ( i != 5)
cout << ",";
i++;
} while ( i < 6);
cout << endl;


return 0;

}

C++ Tutorial

I'm learning C++ this holiday :D

#include

using namespace std;

int main(int argc, char * const argv[])
{

//variable block

int yourAge;
int myAge = 1000000;

//main block
cout << "Hello, World!\n";

cout << "What is your age: ";
cin >> yourAge;
if (yourAge > myAge) {
cout << "Your " << (yourAge-myAge) << " years older than me." << endl;
}
else {
if (yourAge == myAge) {
cout << " You are the same age as me" << endl;
}
else {
cout << "Your " << (myAge-yourAge) << " years younger than me." << endl;
}
}
return 0;
}


Tuesday, December 21, 2010

Monday, November 22, 2010

050


Been too long omg. Hopefully I canm keep this up!

Wednesday, October 13, 2010

Thursday, September 30, 2010


This is from Tuesday Nights Value Studys

Sunday, September 19, 2010

Saturday, September 18, 2010

Friday, September 17, 2010

Thursday, September 16, 2010

Thursday, August 26, 2010

45 Nanotech


I havnt done any 3d ain a while, a friend asked me to get some nanotech viz going that hes working on...I put a artistic twists on it.. gonna paint in ps after....

Wednesday, August 18, 2010

Friday, August 6, 2010

Tuesday, August 3, 2010

Monday, July 26, 2010

Saturday, July 24, 2010

Thursday, July 22, 2010

Wednesday, June 23, 2010

035


Part 1 in a sequence

034

Thursday, June 17, 2010

032


I kit bashed on this one

Wednesday, June 16, 2010

Tuesday, June 15, 2010

Monday, June 14, 2010

029


Just a change of pace

Friday, June 11, 2010

Thursday, June 10, 2010

Wednesday, June 9, 2010

Tuesday, June 8, 2010

Monday, June 7, 2010

Thursday, June 3, 2010

Wednesday, June 2, 2010

Tuesday, June 1, 2010

Friday, May 28, 2010

Thursday, May 27, 2010

Wednesday, May 26, 2010

Tuesday, May 25, 2010

Monday, May 24, 2010

Sunday, May 23, 2010

Friday, May 21, 2010

Wednesday, May 19, 2010