Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › [C++] Tutorial 3: In-Depth Syntax and Rules

Lightbulb[C++] Tutorial 3: In-Depth Syntax and Rules

Posts 1–2 of 2 · Page 1 of 1
Schyler
Schyler
[C++] Tutorial 3: In-Depth Syntax and Rules
Welcome to the third tutorial of the series. Before reading this tutorial it is absolutely vital you read the previous tutorial, number 2.

In this tutorial we will cover:

  • Creating variables and data types
  • More syntax
  • Commenting your code



Part I: Creating the Project

Since not all of you may remember from the last tutorial we are going to go back through creating a project. First, open up Code::Blocks;



Now, into the File menu, highlight the "New" area and select Project;



A window should popup in the foreground. Simply press the Next button. For obvious reasons I won't repeat this instruction anymore. Assume to continue through the dialog as per normal an installation.



In the next window simply select C++.



Now, make sure that your Project creation directories are correct. Call this project "Statements";



You will not need to change any of these Build options, as per last time. Simply press Finish.



Part II: Changing the defaults

After waiting a short while for your project to be created, expand the tree view on the side and open main.cpp as shown in the last tutorial. Your window should now look like this;



Because we don't need the default code, delete the single line that prints Hello World to the console. You will now have an empty main() { ... } loop with a simple return statement. If you are unsure of what to do, just make your code look like what is in the picture;



Our aim for this tutorial is to print some simple maths. Before we do this, I need to explain the data types used in C++. To save memory programmers can choose what type they want a variable to be when they create it. Because of this, all variables have to be pre-declared. I'll explain this later.

void empty data
int integer, from negative 32000 to positive 32000
float floating-point number, can be ignored until later
double a number with decimals, eg: 1.3456 char
a string (words), eg: "Fred"
bool
either a one or a zero, eg: true

The main value type that you will always use is the integer kind. The rest aren't really important to remember and you will pick them up along the way.

Variables, like algebra, can be declared and given names. Here is an example;
Code:
// Create the integer myvariable
int myvariable;

// Set it to 5
myvariable = 5;
Have you noticed the braces? When you see a double brace in C++ it means a comment. When entered into the code editor it will turn green. Only that after a set of braces will not be executed so a command like this is still valid;
Code:
int x; // Comment
Go back to Code::Blocks. We are going to use variables to add numbers together and print to the screen. This may sound complicated at first, but if you just play around with the values you will easily understand it.

Type the following code into the editor as so. Make sure it goes beween the main loop and before the return statement (follow the format of the picture);
Code:
// Create the variable number
int number;

// Set it to 2
number = 2;

// Show us what happens when we add it to itself
cout << number + number << endl;


Now, by using the Build and Run option from the Build menu (as explained in the last chapter). If you are unable to locate it just follow this screenshot;



Wait a few seconds for the build to be completed, and then your program should pop up. It might be hard to see, but up in the corner the program has worked wonders and added 2 + 2 = 4.



Part III: Coding your own maths applications

From here stems a whole world of possibilities. Before letting your mind roam free, I'm going to quickly outline some vital C++ operators. You will have to remember these for later as they are the vital organs of programming in all languages.

2 + 2 = 4, addition
2 * 2 = 4, multiplication
2 - 2 = 0, subtraction
2 / 2 = 1, division

These should be somewhat similar to what you enter into your graphics calculator.

Try the following samples to get a further idea;
Multiplication
Code:
int number;
number = 2;
cout << number * number << endl;
Division
Code:
int number;
number = 2;
cout << number / number << endl;
Addition of several variables
Code:
int number, number2;
number = 2;
number2 = 15;
cout << number + number2 << endl;
Finding the sqaure of a number
Code:
int number;
number = 2;
cout << number * number << endl;
You can now execute simple programs which find things like the areas of sqaures, circles and all kinds of mathematic procedures. Don't forget to use a double value when storing decimals, although this is not needed for hardcoded values;
Code:
int radius;
radius = 2;
cout << (radius * radius)* 3.142 << endl;
Mixing words and numbers
Code:
cout << "The circle can hold " << apples << " apples  before it explodes" << endl;
Don't forget you will need to Build and Run your applications or your new code will not work.

I hope that you enjoyed this tutorial. As an extension activity you could try and find out how the other variables work. If you look back to chapter 2 there is an example usage of the char variable.

In the next tutorial we will cover:

  • Revision
  • Polish our syntax
  • Cover some topics again, explaining in more detail
  • Explaining the use of some of the symbols



Regards,
-Schyler-
#1 · 16y ago
mattmartin77
mattmartin77
well. I found this helpful. Someday I hope to be able to actually make a full CA hack. Everyone needs to start somewhere...
#2 · 16y ago
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

  • Some one show me the thread to MPGH's customs and rules...By Gotchuthief in General
    3Last post 17y ago
  • [Tutorial]How to Register for and Install Crossfire ChinaBy supernova2131 in CrossFire Hacks & Cheats
    0Last post 17y ago
  • Anybody have a tutorial for creating a MOD and hosting it ??By ashiksonic in Call of Duty Modern Warfare 2 Help
    4Last post 15y ago
  • C# Tutorial, starting, learning the basics, and keeping...By 'Bruno in C++/C Programming
    20Last post 16y ago
  • GM'S AND RULES!By vash000 in Flaming & Rage
    0Last post 16y ago

Tags for this Thread

None