Welcome to Spyro the Dragon Forums!

You are not logged in.

#1 Jun 11, 2009 3:19 AM

Hurricos_McBreixo
Member
From: Spring Savanna (A Secret World
Registered: Nov 28, 2006
Posts: 252
Gems: 0

Learn C++ Here!

Well, I know there are some of us here that'd like to learn a programming language to get started on their path to that dream job at a gaming company. That is why I have created this thread, it is to teach you some C++ basics and then some using various sources to better help you understand it.

I will be using bloodshed's C++ compiler for these lessons which can be downloaded here: www.bloodshed.net/dev/devcpp.html
I recommend that you choose the beta 5.0 with Mingw compiler, as it will make things easier.

It will go like this: I will type in a lesson for you to practice on the compiler, then after a few days, I will give you a test on that lesson to see if you got it.

Basically like school, except on the internet and hopefully, more fun.

I will post the first lesson in a few min., and a link to each lesson in this first post, so that you don't have to sort through the thread to find any.


mew.gif

Personal Quote: "Live, thrive, embrace your inner instincts, tear yourself from the burden of the world, so that you may finally... be free."

Offline

#2 Jun 11, 2009 4:57 AM

Hurricos_McBreixo
Member
From: Spring Savanna (A Secret World
Registered: Nov 28, 2006
Posts: 252
Gems: 0

Re: Learn C++ Here!

Lesson 1: Hello World!

When you open your compiler go to File > New > Project > Console Application > Name it whatever you want. That should lead you to a fresh screen with the following:

Hidden text

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    system("PAUSE");
    return EXIT_SUCCESS;
}

ERASE THIS. IT IS NOT NEEDED.

Now since this is the first program you will learn, we will make it say "Hello World! Here comes Spyro!" on the screen. Here is the code you will input:

Hidden text

//Sproforum's First C++ Lesson

#include <iostream>

using namespace std;

int main(){


    cout << "Hello World! Here comes Spyro!\n";

    system("Pause");

}

Now to explain what it all means: The first line "//Sproforum's First C++ Lesson" is only a comment. It has no effect on the program.
Think of it as a way of leaving stickynotes so you can remember which part does which.

The next line that starts the actual code is "#include <iostream>".
This is the standard library that all C++ Compilers have; it allows them to understand and execute any command found in the standard library.
"iostream" contains the basic I/O functions used to write to the screen and recieve input from the user.

"using namespace std;" defines what namespace we will be using, in this case "std".
A namespace is basically a list of variable and function names, in order to not get standard library names mixed with others, the standard library creates the namespace std, so any time you want to use a command from the standard library you must include this line.
The semicolon at the end of the line is needed for almost every line in C++, this tells the compiler that it has reached the end of that line.

"int main(){" this is a function decleration.
A function is a block of code which begins and ends with a pair of curly brackets " { } ".
This way we have a way of referencing this block of code in case if we want the program to run the same code multiple times.
Functions also help keep the code looking clean.
"int" is the data type the function returns, we will discuss data types later.
"main" is the name of this function, every C++ program must have a "main()" function, this is where the program will begin to execute.
If you want to pass a variable to a function, you would place the type of variable and specify a name for it between the parenthesis, for example: "int myFunction( int number)".
The curly bracket shows where the function begins.

"cout << "Hello World!\n";" This line displays the text "Hello World!" on the screen.
"cout" takes the text using "<<" which is known as an insertion operator. Think of it as a funnel, we want the data, in this case "Hello World!", to be "funneled" into cout.
The "\n" means new line, its like pressing the enter key while typing in a text editor.

"system("Pause");" system() is used to send commands to the operating system, in this case we are sending "pause" which is a DOS command which pauses the screen until the user presses any key.
I included this because once the program runs out of code to execute, it will close the window and you will not get a chance to see the results.


Now that you know what it does, type the code into the program. You can copypasta if you want, but it'll help you memorize it better if you just type it in from scratch.
Now that you are finished, hit the Compile and Run button (Third button from the left, has all 4 color boxes put together. In the even you come across a compiler without this button, just press the compile button then run it).
It will bring up a DOSCommand box with the following:

Hidden text

Hello World! Here comes Spyro!
Press any key to continue...

See how easy that was?


Put your copy of your program on sendspace or some other filesharing site with your name in it to so I can see if you have any problems.
To put your name on it simply type "//Insert Spyroforum Name Here" at the top of the program. Of course you type your name after the two foward slashes and not what I've typed above =/.


More lessons coming soon.


mew.gif

Personal Quote: "Live, thrive, embrace your inner instincts, tear yourself from the burden of the world, so that you may finally... be free."

Offline

#3 Jun 11, 2009 8:49 PM

Neotyguy40
Member
Registered: Mar 03, 2008
Posts: 2,036
Gems: 0

Re: Learn C++ Here!

C++ is only a command-line utility language. In other words, it can only do math, arguments, etc. which everyone would know if they just learn the syntax of C++.

APIs, Libraries, and Frameworks are where things truly stand out. I suggest you make a tutorial for OpenGL.


129165566986314279.gif

Offline

#4 Jun 11, 2009 8:59 PM

RedDragonX
Member
From: New Hampshire
Registered: Nov 05, 2008
Posts: 5,457
Gems: 0
Website

Re: Learn C++ Here!

I have only started learning about it a couple weeks ago and it is very in depth with the mathematical equations and such as well as very useful for solid game programming. I'll be learning more about it when I go back to school this fall.


"Everyone has a photographic memory; some just don't have the film."
ps3_la-legende-de-spyro-darkest-hour_1209515151_15-1.jpg

Offline

#5 Jun 11, 2009 9:23 PM

A Guy
Member
From: New York City
Registered: Mar 03, 2008
Posts: 5,711
Gems: 0
Website

Re: Learn C++ Here!

I've been working on something in C++, using that compiler. I could use some lessons.


"Have you seen The Passion yet? Here's a spoiler for you - Jesus dies."

spoiler_tshirt.gif

Offline

#6 Jun 11, 2009 10:29 PM

TornWings
Member
From: My floating island
Registered: Jul 26, 2008
Posts: 500
Gems: 0

Re: Learn C++ Here!

Hey... I can recognize that code... good to know those 2 semesters of programming are still lingering in my head.


Oh great, my lighthouse is on fire again, be right back...

Offline

#7 Jun 11, 2009 11:12 PM

Hurricos_McBreixo
Member
From: Spring Savanna (A Secret World
Registered: Nov 28, 2006
Posts: 252
Gems: 0

Re: Learn C++ Here!

C++ is only a command-line utility language. In other words, it can only do math, arguments, etc. which everyone would know if they just learn the syntax of C++.

APIs, Libraries, and Frameworks are where things truly stand out. I suggest you make a tutorial for OpenGL.

That is a very good suggestion, I'm glad you mentioned it. But these C++ Lessons are just to teach people program scripting. I might make an OpenGL tutorial in the future after this, but for now I will focus on one thing at a time, the graphics can come later.


I have only started learning about it a couple weeks ago and it is very in depth with the mathematical equations and such as well as very useful for solid game programming. I'll be learning more about it when I go back to school this fall.

School is where I've gotten a taste of it, and inspired me to continue on studying it independently.

I've been working on something in C++, using that compiler. I could use some lessons.

That's what this is here for, try out this lesson for yourself and fiddle around with it. As a matter of fact why don't you write a three line statement in C++ coding? That'll be your h.w., lol. Just use the lesson as a guideline, and if you have any questions just post them in this thread.

Hey... I can recognize that code... good to know those 2 semesters of programming are still lingering in my head.

If you practice it'll stay in your head better. As I've said above to A Guy, if you have any questions just post.


mew.gif

Personal Quote: "Live, thrive, embrace your inner instincts, tear yourself from the burden of the world, so that you may finally... be free."

Offline

#8 Jun 11, 2009 11:43 PM

A Guy
Member
From: New York City
Registered: Mar 03, 2008
Posts: 5,711
Gems: 0
Website

Re: Learn C++ Here!

#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

string song;
string activity;

int main ()
{
cout << "Hello there! I am Samuel! \n What is your favorite song? \n";
cin >> song;
cout << song << " is a good song. \n What do you like to do? \n";
cin >> activity;
cout << activity << " is fun! \n";
system("pause");
return 0;
};

Bah, if I could only figure what to declare song and activity as...

EDIT:Completed.


"Have you seen The Passion yet? Here's a spoiler for you - Jesus dies."

spoiler_tshirt.gif

Offline

#9 Jun 12, 2009 4:48 AM

SpiritofCynder
Member
From: In Front of My Computer
Registered: Jun 18, 2008
Posts: 80
Gems: 0

Re: Learn C++ Here!

C++ is a very powerful language, regardless of it being around since 1979. Low level language, very close to Assembly and machine code. In fact on the windows platform, alot of DLL's and device drivers are coded in C/C++ or assembly of some form.

On the Linux platform, the entire kernel is coded in C, as are the device drivers, the libraries, most apps, etc.

Regardless of it being a command line language, it makes it easier for IT to debug system errors, in text mode and have it display possible errors, rather than a graphical interface.

Offline

#10 Jun 12, 2009 4:54 AM

Hurricos_McBreixo
Member
From: Spring Savanna (A Secret World
Registered: Nov 28, 2006
Posts: 252
Gems: 0

Re: Learn C++ Here!

Lesson 2: Variables and Data Types

In this lesson we'll talk about Data Types and the Variables.
As you've seen in the last lesson, it has taken several lines of code just to produce one line of text on the screen.
Now you may wonder how useful it all really is considering it would've been faster to just type the text yourself, but programming isn't limited to printing text on the screen.
In order to be able to write programs that'll perform useful tasks to save us work, we'll need to understand the concept of variables.

To start, here is a list of basic variables:

int: used to store integers (whole numbers, no decimals/fractions)
long: used to store larger integers
double: used to store numbers with two decimal places
float: used to store numbers with multiple decimal places
char: used to store a single character
bool: a Boolean value. It can take one of two values: true or false.

Now to see them at work:

#include <iostream>

using namespace std;

int a;

int main(){

	int b;
	int c;

	cout << "Enter a number: ";
	cin >> a;

	cout << "Enter a second number: ";
	cin >> b;

	c = a+b;

	cout << "The sum is: " << c << "\n";

	system("pause");

}

Here I declared three integers, "a", "b", and "c". You'll see the "a" is outside of main(), this means that it is a global variable; all functions can access it freely, but since "b" and "c" were declared inside of main() it is only accessible to main().

Our next new line would be "cin << a+b;". Here we see the insertion operator again, except this time its pointing in the other direction.
Since cin is the command for input, we want to "funnel" the data from the function to the variable.

After collecting the information from the user we use it to give "c" a value. "c = a+b;" give "c" the value of the sum of "a" and "b", you can also use "-" for subtraction, "*" for multiplication, and "/" for division.

Finally we display the value of "c", notice how there are two insertion operators in the final output? This allows us to display text and variables in one line instead of having to write "cout" several times. Notice how text is written in between quotes and variables are without quotes. If you wanted to assign a variable a number you would not use quotes either ( int a = 10; ).


Now we'll try it a different way with set variables:

a = 2;
b = 3;
a = a + 1;
result = a - b;

By telling it what the initial variable is first the program will recognize "a" as "2" before moving down to the next piece of code that says otherwise.
In this case "a = a + 1" which will tell the program that the variable it has been given has another variable added later on, turning it into "3".
"Result" shows what the answer is after the program has done the math "result = 3 - 3".

#include <iostream>
using namespace std;

int main ()
{

  int a, b;
  int result;

  a = 2;
  b = 3;
  a = a + 1;
  result = a - b;

  cout << result << "\n";

}

This will just display the answer to the problem on the screen:

0
Press any key to continue...

Do not worry if something else than the variable declarations themselves looks a bit strange to you. You will see the rest in detail in the upcoming lessons.


Each variable needs an identifier that distinguishes it from the others, for example, in the previous code the variable identifiers were a, b and result, but we could have called the variables any names we wanted to invent, as long as they were valid identifiers.

A valid identifier is a sequence of one or more letters, digits or underscore characters (_).
Neither spaces nor punctuation marks or symbols can be part of an identifier.
Only letters, digits and single underscore characters are valid. In addition, variable identifiers always have to begin with a letter.
They can also begin with an underline character (_ ), but in some cases these may be reserved for compiler specific keywords or external identifiers, as well as identifiers containing two successive underscore characters anywhere. In no case they can begin with a digit.

Another rule that you have to consider when inventing your own identifiers is that they cannot match any keyword of the C++ language nor your compiler's specific ones, which are reserved keywords.

The standard reserved keywords are:

asm
auto
bool
break
case
catch
char
class
const 
const_cast 
continue 
default
delete
do
double
dynamic_cast
else
enum
explicit
export
extern
false
float
for
friend
goto
if
inline
int
long
mutable
namespace
new
operator
private
protected
public
register
reinterpret_cast
return
short
signed
sizeof
static
static_cast
struct
switch
template
this
throw
true
try
typedef
typeid 
typename
union
unsigned
using
virtual
void
volatile
wchar_t
while

An example of inventing your own identifiers is this:

int NumberOfOrbs
int AvalarGuidebook

See? Nothing to it.

Additionally, alternative representations for some operators cannot be used as identifiers since they are reserved words under some circumstances:

and 
and_eq
bitand
bitor
compl
not
not_eq
or
or_eq
xor
xor_eq
 

Your compiler may also include some additional specific reserved keywords.

Very important: The C++ language is a "case sensitive" language. That means that an identifier written in capital letters is not equivalent to another one with the same name but written in small letters. Thus, for example, the RESULT variable is not the same as the result variable or the Result variable. These are three different variable identifiers.

This one was longer than the last one but hopefully it wasn't too bad for you guys. *is only saying that cause I'll be posting longer ones* smile


mew.gif

Personal Quote: "Live, thrive, embrace your inner instincts, tear yourself from the burden of the world, so that you may finally... be free."

Offline

#11 Jun 12, 2009 2:08 PM

Hurricos_McBreixo
Member
From: Spring Savanna (A Secret World
Registered: Nov 28, 2006
Posts: 252
Gems: 0

Re: Learn C++ Here!

A Guy wrote:
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

string song;
string activity;

int main ()
{
cout << "Hello there! I am Samuel! \n What is your favorite song? \n";
cin >> song;
cout << song << " is a good song. \n What do you like to do? \n";
cin >> activity;
cout << activity << " is fun! \n";
system("pause");
return 0;
};

Bah, if I could only figure what to declare song and activity as...

EDIT:Completed.

Good job! Though I expected something different than that, I'm glad to see that you understand Strings. We'll be going over that soon.

For now, you get an A.


mew.gif

Personal Quote: "Live, thrive, embrace your inner instincts, tear yourself from the burden of the world, so that you may finally... be free."

Offline

#12 Jun 14, 2009 6:39 AM

Hurricos_McBreixo
Member
From: Spring Savanna (A Secret World
Registered: Nov 28, 2006
Posts: 252
Gems: 0

Re: Learn C++ Here!

Lesson 3: Cout, Cin and the Strings

I've realized that in the last 2 lessons, I've failed to go into detail on what does the two operators, Cin and Cout, do.

cout << "Hunter Rocks"; // prints Hunter Rocks on screen
cout << 22475;             // prints number 22475 on screen
cout << h;                   // prints the content of h on screen 

Cout is usually used with the insertion operator "<<".
The << operator inserts what ever data comes after it into the program.
In the code above it inserted the constant string Hunter Rocks, the numerical constant 22475 and variable h into the standard output stream cout.
Notice that the sentence in the first instruction is enclosed between double quotes (") because it is a constant string of characters.
Whenever we want to use constant strings of characters we must enclose them between double quotes (") so that they can be clearly distinguished from variable names.
For example, these two sentences have very different results:

cout << "hai thar";  // prints hai thar
cout << hai thar;    // prints the content of hai thar variable 

The insertion operator "<<" can be used more than once:

cout << "Hello, " << "I am " << "a C++ statement";

This last statement would print the message Hello, I am a C++ statement on the screen.
The utility of repeating the insertion operator (<<) is demonstrated when we want to print out a combination of variables and constants or more than one variable:

cout << "Hello, I am " << screenname << " and my country is " << country;

Let's say that the "screenname" variable is Hurricos_McBreixo and the "country" variable is U.S.A, the screen would print this after running.

Hello, I am Hurricos_McBreixo and my country is U.S.A

WARNING: notice that cout does not add a line break after its output unless we explicitly indicate it, therefore, the following statements:

cout << "I hate Gear Grinders.";
cout << "Gear Grinders suck."; 

Would be read as this:

I hate GearGrinders.Gear Grinders suck.

In order to perform a line break on the output we must insert a new-line character into cout.
In C++ a new-line character can be specified as "\n" (backslash, n):

cout << "Save the baby turtles.\n";
cout << "Prince Fromit demands it.\n"; 

Which will come out as this:

Save the baby turtles.
Prince Fromit demands it.

Although you can also use, my fav. to add a new line, the endl manipulator:

cout << "Yay a talisman!." << endl;
cout << "Dragon Shores is fun!" << endl;  

Prints:


Yay a talisman
Dragon Shores is fun!

That's enough about Cout, let's move onto Cin:

Cin is usually used with the extraction operator ">>".
The operator takes the data of what the user inputs (usually by keyboard).
It must be followed by the variable that will store the data that is going to be extracted; for example:

int type;
cin >> type; 

The first statement declares a variable of int called "type", and the second one waits for an input from cin (the keyboard) in order to store it in this integer variable.

Cin can only process the input from the keyboard once the RETURN key has been pressed.
You must always consider the type of the variable that you are using as a container with cin extractions.

If you request an integer you will get an integer.
if you request a character you will get a character.
If you request a string of characters you will get a string of characters.

// For example

#include <iostream>
using namespace std;

int main ()
{
  int h;
  cout << "Please enter an integer value: ";
  cin >> h;
  cout << "The value you entered is " << h;
  cout << " and its double is " << h*2 << ".\n";
  return 0;
}

Here's what I've input:

Please enter an integer value: 75
The value you entered is 75 and its double is 150.

The user of a program may be one of the factors that generate errors even in the simplest programs that use cin (like the one we have just seen).
Since if you request an integer value and the user introduces a name (which generally is a string of characters), the result may cause your program to mis-operate since it is not what we were expecting from the user.
So when you use the data input provided by cin extractions you will have to trust that the user of your program will be cooperative and that he/she will not introduce his/her name or something similar when an integer value is requested.
Heads up, when we see the stringstream class we will see a possible solution for the errors that can be caused by this type of user input (haha for the smart-alecks who wants to screw over your program).

You can also use cin to request more than one data input from the user:

cin >> a >> b;

It'll be the same as this:

cin >> a;
cin >> b;

So in both cases the user must give two data, one for variable a and another one for variable b that may be separated by any valid blank separator: a space, a tab character or a newline.


We can use cin to get strings with the extraction operator (>>) as we do with data type variables:

cin >> dragonstring;

IMPORTANT!: As it has been said, cin extraction stops reading as soon as if finds any blank space character, so in this case we will be able to get just one word for each extraction.
This behavior may or may not be what we want; for example if we want to get a sentence from the user, this extraction operation would not be useful.

In order to get entire lines, we can use the function getline, which is the more recommendable way to get user input with cin:

// cin with strings
#include <iostream>
#include <string>
using namespace std;

int main ()
{
  string dragonstr;
  cout << "What's your name? ";
  getline (cin, dragonstr);
  cout << "Hello " << dragonstr << ".\n";
  cout << "What is your favorite team? ";
  getline (cin, dragonstr);
  cout << "I like " << dragonstr << " too!\n";
  return 0;
}

My input:

What's your name? Mary-Jane
Hello Mary-Jane.
What is your favorite team? The Mets
I like The Mets too!

Notice how in both calls to getline we used the same string identifier (dragonstr).
What the program does in the second call is simply to replace the previous content by the new one that is introduced.

The standard header file <sstream> defines a class called stringstream that allows a string-based object to be treated as a stream.
This way we can perform extraction or insertion operations from/to strings, which is especially useful to convert strings to numerical values and vice versa.
For example, if we want to extract an integer from a string we can write:

string dragonstr ("7");
int forumint;
stringstream(dragonstr) >> forumint;

This declares a string object with a value of "7", and an int object.
Then we use stringstream's constructor to construct an object of this type from the string object.
Because we can use stringstream objects as if they were streams, we can extract an integer from it as we would have done on cin by applying the extractor operator (>>) on it followed by a variable of type int.

After this piece of code, the variable myint will contain the numerical value 7.

// stringstreams
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main ()
{
  string dragonstr;
  float price=0;
  int quantity=0;

  cout << "Enter price: ";
  getline (cin,dragonstr);
  stringstream(dragonstr) >> price;
  cout << "Enter quantity: ";
  getline (cin,dragonstr);
  stringstream(dragonstr) >> quantity;
  cout << "Total price: " << price*quantity << endl;
  return 0;
}

My input:

Enter price: 22.25
Enter quantity: 7
Total price: 155.75

In this example, we acquire numeric values from the standard input indirectly.
Instead of extracting numeric values directly from the standard input, we get lines from the standard input (cin) into a string object (dragonstr), and then we extract the integer values from this string into a variable of type int (quantity).

Using this method, instead of direct extractions of integer values, we have more control over what happens with the input of numeric values from the user, since we are separating the process of obtaining input from the user (we now simply ask for lines) with the interpretation of that input.
Therefore, this method is usually preferred to get numerical values from the user in all programs that are intensive in user input.


Now we make Strings our main focus:

As you may know from the above insight on cin and cout, a string is an array of characters.
In order to get text from a user you must use a string.
Here is an example:

#include <iostream>

using namespace std;

int main(){

	char myArray[50];

	cout << "Whats the password? ";
	
	cin.getline( myArray, 50, '\n');
	
	if( !strcmp( myArray, "Sparx")){
	 
	 strcat( myArray, " is correct! Access granted!\n");
   
	} else {
	 
      	strcpy( myArray, "Invalid password!\n");
	    
 	}    
	
	cout << myArray;

	system("pause");

}

Here we begin by declaring a string of 50 characters.

"cin.getline( myArray, 50, '\n');", the first parameter getline() takes is the string you want to store the data in, next is the max amount of characters allowed, and finally what you want the string to be terminated with.

"if( !strcmp( myArray, "cheesecake")){" will check if myArray is equal to Sparx.
Notice how I used the Not operator here, this is because strcmp returns false if the condition is met.
Also remember strcmp() is case sensitive!

"strcat( myArray, " is correct! Access granted!\n");" This will add " is correct! Access granted!\n" to the end of myArray.

"strcpy( myArray, "Invalid password!\n");" This will replace myArray with "Invalid password!\n".
Whatever was in myArray will be wiped out and replaced by the text.


Now for the h.w.! Post your own code for a password, and another where your comp will ask you a series of questions (at least 3) for you to reply (input) to.

Have fun! I'll go over Arrays in the next lesson since I'm too tired to go over it here.


mew.gif

Personal Quote: "Live, thrive, embrace your inner instincts, tear yourself from the burden of the world, so that you may finally... be free."

Offline

#13 Jun 14, 2009 7:33 PM

A Guy
Member
From: New York City
Registered: Mar 03, 2008
Posts: 5,711
Gems: 0
Website

Re: Learn C++ Here!

Sorry, my Internet was down.


"Have you seen The Passion yet? Here's a spoiler for you - Jesus dies."

spoiler_tshirt.gif

Offline

#14 Jun 14, 2009 8:43 PM

Hurricos_McBreixo
Member
From: Spring Savanna (A Secret World
Registered: Nov 28, 2006
Posts: 252
Gems: 0

Re: Learn C++ Here!

That's ok, as long as you are able to view it  it's no prob smile


mew.gif

Personal Quote: "Live, thrive, embrace your inner instincts, tear yourself from the burden of the world, so that you may finally... be free."

Offline

#15 Jun 22, 2009 4:22 AM

midget_roxx
Member
From: Australia
Registered: Jan 12, 2009
Posts: 277
Gems: 0

Re: Learn C++ Here!

Lol i think i will stick with VB ... until we have to start learning about C++ sad. Also are databases written in C++?

Offline

#16 Nov 19, 2009 7:30 PM

Hurricos_McBreixo
Member
From: Spring Savanna (A Secret World
Registered: Nov 28, 2006
Posts: 252
Gems: 0

Re: Learn C++ Here!

Quick answer: No

Long answer: Some "database servers" might be written in C++. A typical relational database itself is an abstract storage medium, where the protocol has been abstracted to not reflect any language(except for query languages)

EDIT: Also, sorry for being away from this thread for too long. Just got back into the Spyroforum swing of things big_smile


mew.gif

Personal Quote: "Live, thrive, embrace your inner instincts, tear yourself from the burden of the world, so that you may finally... be free."

Offline

#17 Nov 19, 2009 11:09 PM

dragon protector x
Member
From: Colorado
Registered: Sep 08, 2007
Posts: 2,419
Gems: 20
Birthday: 30 January
Age: 33 years old
Gender: Male
Website

Re: Learn C++ Here!

X3 Im blown away! none of this i leanrned in web design.... only the typle
<head>
<body>
<Table>
<Tr>
<td>
</td>
</tr>
</table>
<a href="....">
</a>
<img src="...">
</img>
and blah and so forth. dont remember the meta or java script stuff to well.


I am a starting artist and video editor.

Offline

#18 Nov 21, 2009 4:57 PM

Apoc
Member
From: Sigil
Registered: Oct 04, 2009
Posts: 3,874
Gems: 0
Birthday: 18 June
Age: 33 years old
Gender: Male

Re: Learn C++ Here!

I think I'll keep this, I can use this thread and How to Use C++ for Dummies.


planescape_torment_by_runtimerror-d344sle.png

Offline

#19 Nov 23, 2009 3:51 AM

Neotyguy40
Member
Registered: Mar 03, 2008
Posts: 2,036
Gems: 0

Re: Learn C++ Here!

CPlusPlus

Simple, easy, quick tutorials on the syntax of C++.

EDIT: Deleted code because I made a stupid mistake...


129165566986314279.gif

Offline

#20 Nov 27, 2009 10:17 PM

Hurricos_McBreixo
Member
From: Spring Savanna (A Secret World
Registered: Nov 28, 2006
Posts: 252
Gems: 0

Re: Learn C++ Here!

Whats with the many pointers? Thats not so c++. Especially char**. use std::vector or something nice like that. And what does VECTOR_SET_ASSOCIATION do?


mew.gif

Personal Quote: "Live, thrive, embrace your inner instincts, tear yourself from the burden of the world, so that you may finally... be free."

Offline

#21 Dec 01, 2009 12:26 AM

Neotyguy40
Member
Registered: Mar 03, 2008
Posts: 2,036
Gems: 0

Re: Learn C++ Here!

Hurricos_McBreixo wrote:

Whats with the many pointers? Thats not so c++. Especially char**. use std::vector or something nice like that. And what does VECTOR_SET_ASSOCIATION do?

C++ itself is a very short language. It is basically math, statements, functions, and classes. It doesn't take more then 2-3 weeks to learn it if you spend about an hour a day at it, but the hard part? APIs.

An API takes C++ (or other languages) out of the command-line program and into things with graphics, sounds, interfaces, etc.

There are many APIs. Ever hear of DirectX? That is an API (actually a group of APIs mixed into one).

An API is a group of functions that tell the actual hardware what to do. C++ calls math and other memory functions, while APIs use that memory to tell the computer what to do.

One major API that is really famous is OpenGL, because it is the most used graphics API in the world. I suggest you learn that if you already learned C++.

Read The Official OpenGL Guide.

I have found what my problem was anyway with the script. I was sending the *sizeof through U32 when I was compiling on 64bit mode.


129165566986314279.gif

Offline

Board footer

Powered by FluxBB