Bien venido Iniciar Sesión o Regístrate
Chat Beta | Agreganos a tus favoritos | Ayuda | Lenguage:
 

 
 
ian
Perfil   Galería   Blogs   Libro de visitas   Amigos   Favoritos   Videos  
 


Viendo 1 - 2 de 2 Blogs.


C++ Hacking
Añadido 18/03/2008 13:05:09
Differences between C++ and C#:
Differences between C++ and C#

I advise you to begin with this, it really helped me a lot. Then move onto the books.
Credits: DarkRising Forum Quote:
Well this is my first tutorial geared at true beginners at this language. I'm just about intermediate so I'm no expert at this so please forgive me if I make any errors.

Let's start you off with the simple old "Hello World" program.

It goes something like this :


CODE
#include // include header file

using namespace std; // uses namespace std

int main() // start or entry point of your program
{
cout

What that does is that it includes the header file called iostream. And what is a header file you might ask? A header file is a file that may contain various functions, constants. Just pretty much any type of C++ code.

Then you have :
using namespace std;

If you look a little further down in the code, you will see the like that begins with cout. The actual code is std::cout but since we declared that we were going to use the namespace std we can omit the std:: from our code.

int main()

hmmm what is this int main() ?

This is what pretty much states that your program has begun.
You will notice your opening and closing braces. { and }
Always enclose your program with these braces.

Ok, now we will examine cout a bit closer.
cout
using namespace std;
int main()
{
int Number; // a variable declared of type integer

cout>Number; // asks for user input into the integer variable number

cout>

notice the change ..instead of the output operators >

cin>> is used to accept input from the user.

we have cin>>Number;

This means whatever the user enters is stored in the variable Number.
Since Number is of type integer, it can only store numbers .

Some of the other data types are char,float,double,long,string , bool.

After cin>> we have cout again.

Like before we have the text we want to display surrounded by " ". however instead of ending it there, i went on to add another set of
#include
#include
usng namespace std;
int main()
{
int age;
cout>age; // asks for user input

if(age < 50) >{
cout<<"You are under 50 years old!";
}
else if(age 50)
{
cout
#include
#include
using namespace std;

int main()
{
int Age;

cout>Age;

switch(Age) //
{
case 1: cout
using namespace std;
int main()
{
int board[9];

// we want to set all members of the array to 0
// notice the use of the for loop

for(int i=0;i < function name>( )
{

//code

}



Ok, I guess that isn't too clear. I think an actual example will make this a bit clearer.
How about..um...a function that prints a line of text.

CODE
void PrintLine()
{
cout<<"This function prints a line of text!";
}


This is an example of a simple function.
Let's examine it line by line. The return type is void. The return type is the type of variable that the function returns.
This function returns nothing, so we put the return type as void.
The next part of it is the function name. This can be anything but I would recommend that you make your function names descriptive.
This is especially useful when you start writing programs that are longer than 200 lines long as you will have lots of functions and its
very easy to forget which function does what.

This is a more complicated function.

CODE
void Multiply(int num1, int num2)
{
cout<<( num 1 * num2 );
}


This function has a return type of void which means it returns nothing. However, unlike the previous function, this one takes 2 parameters. It takes
2 intergers. It then multiplies them and prints the resut.
This is very nice and well but what if you wanted to put the result into a variable then print it. There's another way to do this.
This is the method that I prefer the most. I think i'll give you a little intro into error checking also while we're here.

CODE
int Multiply(int num1, int num2)
{
int result = num1 * num2;
return result;
}


As you can see, this function has a return type of integer .
This function allows for some flexibility and direct error checking.
Let's have a look. Assume that the multiply function was already declared in my code.

CODE
int x = Multiply(5,2); // Since multiply returns an integer value, the value returned can directly be used in an assignment operation.

// There is also this way.

cout<<Multiply(5,2);

// Time for an intro to error checking

//Note: Function and code placed in the condition section of if-else statements is executed

// == is used to compare to values or variables

if( ( Multiply(5,2) ) == 10 )
{
cout<<"Multiplication function succeeded!";
}
else if(( Multiply(5,2) ) != 10)
{
cout<<"Multiplication function failed!";
}




After you have read all of this, go over it with This

Now, time to move onto the books.

Here are all the books you should use

Order of the books you should read first and last.
Sams teach yourself C++ in 24 Hours.
Learn C++ Folder
c++ professional programmers handbook
C++ For Dummies

~~~~~~~

For the people who do not like reading, Videos FTW!
Code:
http://rapidshare.com/files/16294092/3DBuzz_-_C___-_Issue_1_-_1_Intro_to_C__.avi
http://rapidshare.com/files/16294094/3DBuzz_-_C___-_Issue_1_-_2_Variables_and_Data_Types.avi
http://rapidshare.com/files/16294128/3DBuzz_-_C___-_Issue_1_-_3_Operators.avi
http://rapidshare.com/files/16294139/3DBuzz_-_C___-_Issue_1_-_4_Control_Statements_Branching.avi
http://rapidshare.com/files/16294104/3DBuzz_-_C___-_Issue_1_-_5_Control_Statements_Looping.avi
http://rapidshare.com/files/16294113/3DBuzz_-_C___-_Issue_1_-_6_Arrays.avi
http://rapidshare.com/files/16294037/3DBuzz_-_C___-_Issue_2_-_1_Intro.avi
http://rapidshare.com/files/16294131/3DBuzz_-_C___-_Issue_2_-_2_Pointers.avi
http://rapidshare.com/files/16294063/3DBuzz_-_C___-_Issue_2_-_3_Structures.avi
http://rapidshare.com/files/16294183/3DBuzz_-_C___-_Issue_2_-_4_Functions.avi
http://rapidshare.com/files/16294278/3DBuzz_-_C___-_Issue_2_-_5_Classes.avi
http://rapidshare.com/files/16294135/3DBuzz_-_C___-_Issue_2_-_6_Inheritance.avi
http://rapidshare.com/files/16294133/3DBuzz_-_C___-_Issue_3_-_1_Introduction.avi
http://rapidshare.com/files/16294157/3DBuzz_-_C___-_Issue_3_-_2_Project_Management.avi
http://rapidshare.com/files/16294156/3DBuzz_-_C___-_Issue_3_-_3_Game_Loop.avi
http://rapidshare.com/files/16294315/3DBuzz_-_C___-_Issue_3_-_4_DrawEngine.avi
http://rapidshare.com/files/16294149/3DBuzz_-_C___-_Issue_3_-_5_Sprite.avi
http://rapidshare.com/files/16294084/3DBuzz_-_C___-_Issue_3_-_6_Character.avi
http://rapidshare.com/files/16294365/3DBuzz_-_C___-_Issue_3_-_7_Level.avi
http://rapidshare.com/files/16294277/3DBuzz_-_C___-_Issue_3_-_8_Enemy.avi
http://rapidshare.com/files/16294212/3DBuzz_-_C___-_Issue_3_-_9_Mage_and_Fireball.avi




Alot of people have been asking for a compiler, so...
http://www.warez-bb.org/viewtopic.php?t=858744&highlight=

Register at that site, you can find most of anything you need.

Enjoy

Palabras Clave: Hacking English Games Juegos C++


Games
Añadido 18/03/2008 12:29:16

Hi everybody

Check out my new Group 

 

Hola

Miren mi grupo nuevo de juegos.