Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Basic C++ Tutorial

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Santtu K
Newbie cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 17

PostPosted: Sat Mar 01, 2008 5:33 am    Post subject: Basic C++ Tutorial Reply with quote

Okay Lets start, i will not explain what C++ is or anything else to it I will just teach you how to program.
So, like all languages we will start with the classical “Hello World” program here is code:

Code:

#include <iostream.h>

void main()
{
  std::cout << "Hello world!";
}


I will explain it now, on the first row there is the “preprocessor” it can be recognized from the # in the beginning.

”#include <iostream.h>” includes a file named iostream.h in that place, iostream.h has printing and such related functions stored in it, eg. cout.

”void main()” In it there is the main function of the program degclared, every c++ program has to have a “main()” in them. Void means that the main() will not retrieve a value.

“{“ starts the main() part of the program and there we can find our old friend “cout”, cout is a object. Now you only need to know that “cout” is used for printing text: After cout come the “<<” after these the text you want printed to the screen is written here, inside the “ “ . Last is the ; which ends every line in C++

And then the } which ends the main()

Sorry for my english it is not that good
And it is a bit hard for me to explain these in english, hope you understand. I will continue this tutorial sooN!

_________________
nowadaysidoc++andasm


Last edited by Santtu K on Sat Mar 01, 2008 6:07 am; edited 1 time in total
Back to top
View user's profile Send private message
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Sat Mar 01, 2008 5:53 am    Post subject: Reply with quote

If i may add a second part of it:

Code:

#include <iostream.h>
char name[255];
void main()
{
  cout << "Hello what is your name?\n";
  cin >> name;
  cout << "Hello " << name;
}


so..
what does this do?

char name[255];
makes a new string variable.
"\n" makes a new line.
cin >> name;

User inputs a value to variable named "name"

cout << "Hello " << name;


Console says "Hello " and the value of variabe named "name"

i am not good at explaining things so i hope people will understand it.
Back to top
View user's profile Send private message
systat
Advanced Cheater
Reputation: 0

Joined: 15 Feb 2008
Posts: 54

PostPosted: Sat Mar 01, 2008 5:54 am    Post subject: Reply with quote

Code:

#include <iostream.h>

void main()
{
  cout << "Hello world!";
}


This wouldn't work if compiled, you must write it like this



Code:

#include <iostream.h>

void main()
{
  std::cout << "Hello world!";
}


or even better, using namespaces

Code:

#include <iostream>
using namespace std;
void main()
{
  cout << "Hello world!";
}

_________________
uuuuuuuuuuuuu
Back to top
View user's profile Send private message
Santtu K
Newbie cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 17

PostPosted: Sat Mar 01, 2008 6:10 am    Post subject: Reply with quote

Thanks systat !
Masterkert was just going to write abou cin xD

_________________
nowadaysidoc++andasm
Back to top
View user's profile Send private message
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Sat Mar 01, 2008 6:51 am    Post subject: Reply with quote

systat!

If you include <iosteam> then cout << would work.
When you dont have <iostream> then std::cout would work.
Back to top
View user's profile Send private message
systat
Advanced Cheater
Reputation: 0

Joined: 15 Feb 2008
Posts: 54

PostPosted: Sat Mar 01, 2008 7:25 am    Post subject: Reply with quote

It's not true, i tried that, at least with VC++ 2008
Back to top
View user's profile Send private message
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Sat Mar 01, 2008 7:35 am    Post subject: Reply with quote

VC++ 2008.. coding between VC++6 and VC++2008 is very different.

YOu should download dev-cpp then try it there
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Mar 01, 2008 9:51 am    Post subject: Reply with quote

masterkert3 wrote:
VC++ 2008.. coding between VC++6 and VC++2008 is very different.

YOu should download dev-cpp then try it there


The coding didn't change much at all. There are a few slight changes to a few functions but nothing major. The only major change I would say was the upgrade to the secure functions of the CRT and such. But these are all good updates that everyone should take advantage of for security reasons.

Almost every function was updated to handle better string manipulation to prevent buffer overflows and other tactics used to crash programs and such.

As for my opinion, as well as the opinion of many others on these forums, Dev-C++ is crap, don't use it. It is extremely outdated. (+4 years and going without updates and so on and the compiler it uses is +5 years and going.)

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Sat Mar 01, 2008 9:57 am    Post subject: Reply with quote

dev-cpp is just a compiler that is not VB2008.
btw: santtu, the next thing you should add is "If/else"
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Mar 01, 2008 10:02 am    Post subject: Reply with quote

masterkert3 wrote:
dev-cpp is just a compiler that is not VB2008.
btw: santtu, the next thing you should add is "If/else"


Uh, no?

Dev-C++ is an IDE, the compiler Dev-C++ uses is a horribly ported copy of MinGW.

Edit:

On a side note, this is probably a copy paste, or slightly modified tutorial. This is the account of someone that recently got banned for copy pasting a ton of other peoples work and taking credit for it. If anyone finds the original or what looks to be the same, post the link. Smile

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sat Mar 01, 2008 10:55 am    Post subject: Reply with quote

I have experienced DEV cpp when i was on my old comp -i couldn't run VC++ - It is crap.

Dev doesn't pick up on errors that most compilers would, leaving bad habits. Also it doesn't optimize output like VC does.

This tut is crap and full of errors
Back to top
View user's profile Send private message
Santtu K
Newbie cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 17

PostPosted: Sat Mar 01, 2008 11:43 am    Post subject: Reply with quote

Wiccaan wrote:
masterkert3 wrote:
dev-cpp is just a compiler that is not VB2008.
btw: santtu, the next thing you should add is "If/else"


Uh, no?

Dev-C++ is an IDE, the compiler Dev-C++ uses is a horribly ported copy of MinGW.

Edit:

On a side note, this is probably a copy paste, or slightly modified tutorial. This is the account of someone that recently got banned for copy pasting a ton of other peoples work and taking credit for it. If anyone finds the original or what looks to be the same, post the link. Smile

God damnit thats not fair Wiccaan! Now that im exposed I can start using proper grammar again :3
This time you wont find the original because IT DOES NOT EXIST.
I do know -advanced C++, Delphi and ASM

_________________
nowadaysidoc++andasm
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Mar 01, 2008 12:02 pm    Post subject: Reply with quote

Santtu K wrote:
Wiccaan wrote:
masterkert3 wrote:
dev-cpp is just a compiler that is not VB2008.
btw: santtu, the next thing you should add is "If/else"


Uh, no?

Dev-C++ is an IDE, the compiler Dev-C++ uses is a horribly ported copy of MinGW.

Edit:

On a side note, this is probably a copy paste, or slightly modified tutorial. This is the account of someone that recently got banned for copy pasting a ton of other peoples work and taking credit for it. If anyone finds the original or what looks to be the same, post the link. Smile

God damnit thats not fair Wiccaan! Now that im exposed I can start using proper grammar again :3
This time you wont find the original because IT DOES NOT EXIST.
I do know -advanced C++, Delphi and ASM


I call bullshit on your claim. You say you know advanced stuff but yet, not a single post from you has been something of your own. You claim the above is yours, but you typed it in complete shit English, so it's probably just another modified post from some other site.

I have no remorse for you as you seem to not care about others and what they have contributed to the welfare of others on the internet. The internet is a resource to be used for help, not to steal credit of others work so you look "smart". Which already, you look stupid as fuck because you got banned once, then came back and did the same shit again.

Copy pasting is not tolerated here. I'm moving to perm ban you again. Keep coming back, you will just keep getting banned.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites