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 › Basic C++ Commands and What They Do

Basic C++ Commands and What They Do

Posts 1–15 of 17 · Page 1 of 2
KR
Krypton1x
Basic C++ Commands and What They Do
These processes are based off the basic "Hello World" program.


Code:
//
// creates a comment line. All lines beginning with "//" are considered comment lines, and do not effect the program in any way. A programmer can use these to give brief explanations of a code within the code itself.

Code:
#include < iostream>
Lines beginning with a number (hash) sign "#" are directives for the preprocessor. They are not regular code lines with expressions but indications for the compiler's preprocessor. Basically, they tell the program to include certain library files. This specific file (iostream) includes the declarations of the basic standard input-output library in C++, and it is included because its functionality is going to be used later in the program.

Code:
using namespace std;
All the elements of the standard C++ library are declared within what is called a namespace, the namespace with the name std. So in order to access its functionality we declare with this expression that we will be using these entities. This line is very frequent in C++ programs that use the standard library, and in fact it will be included in most of the source codes included in these tutorials.

Code:
int main ()
This line corresponds to the beginning of the definition of the main function. The main function is the point by where all C++ programs start their execution, independently of its location within the source code. It does not matter whether there are other functions with other names defined before or after it - the instructions contained within this function's definition will always be the first ones to be executed in any C++ program. For that same reason, it is essential that all C++ programs have a main function.

The word main is followed in the code by a pair of parentheses (()). That is because it is a function declaration: In C++, what differentiates a function declaration from other types of expressions are these parentheses that follow its name. Optionally, these parentheses may enclose a list of parameters within them.

Right after these parentheses we can find the body of the main function enclosed in braces ({}). What is contained within these braces is what the function does when it is executed.

Code:
cout << "Hello World!";
This line is a C++ statement. A statement is a simple or compound expression that can actually produce some effect. In fact, this statement performs the only action that generates a visible effect in our first program.

cout is the name of the standard output stream in C++, and the meaning of the entire statement is to insert a sequence of characters (in this case the Hello World sequence of characters) into the standard output stream (cout, which usually corresponds to the screen).

cout is declared in the iostream standard file within the std namespace, so that's why we needed to include that specific file and to declare that we were going to use this specific namespace earlier in our code.

Notice that the statement ends with a semicolon character (. This character is used to mark the end of the statement and in fact it must be included at the end of all expression statements in all C++ programs (one of the most common syntax errors is indeed to forget to include some semicolon after a statement).

Code:
return 0;
The return statement causes the main function to finish. return may be followed by a return code (in our example is followed by the return code with a value of zero). A return code of 0 for the main function is generally interpreted as the program worked as expected without any errors during its execution. This is the most usual way to end a C++ console program.

And your finished code should be:

Code:
//Tony's C++ Program
#include <iostream>
using namespace std;

int main()
{
      cout << "Hello MPGH";
      cout << "Don't hate on this, it helps.";
      return 0;
}
Yes I did copy and paste some of this.


If you want the program to stay open until you hit enter, this is the code:

Code:
//Tony's C++ Program
#include <iostream>
using namespace std;

int main()
{
      cout << "Hello MPGH";
      cout << "Don't hate on this, it helps.";
      cin.get();
}
Just change
Code:
return 0;
to
Code:
cin.get();
#1 · edited 16y ago · 16y ago
Gab
Gab
Its a tut from a link of the tutorial sticky thread (Yes my sentence may look difficult )
#2 · 16y ago
KR
Krypton1x
Quote Originally Posted by xXModz View Post
Its a tut from a link of the tutorial sticky thread (Yes my sentence may look difficult )
It is?...
#3 · 16y ago
Auxilium
Auxilium
[php]ess tee dee SEE aot << kwote HI end kwote Semikolon[/php]
#4 · 16y ago
KR
Krypton1x
Quote Originally Posted by Koreans View Post
[php]ess tee dee SEE aot << kwote HI end kwote Semikolon[/php]
What? o.O ...
#5 · 16y ago
Auxilium
Auxilium
Quote Originally Posted by Tony View Post


What? o.O ...
Read slowly boi


you also never made a newline so it would just be on the same line, so you wouldnt need 2 couts
#6 · 16y ago
KR
Krypton1x
Quote Originally Posted by Koreans View Post

Read slowly boi


you also never made a newline so it would just be on the same line, so you wouldnt need 2 couts
Never said I wanted it to be on a separate line. If I wanted it to be on a separate line, I would add
Code:
\n
or
Code:
endl;
#7 · 16y ago
Auxilium
Auxilium
Quote Originally Posted by Tony View Post


Never said I wanted it to be on a separate line. If I wanted it to be on a separate line, I would add
Code:
\n
or
Code:
endl;
and whyd you use 2 couts?
#8 · 16y ago
NextGen1
NextGen1
It's not "based" off "hello World" it is copied and pasted

Credits?
#9 · 16y ago
KR
Krypton1x
cplusplus.com - The C++ Resources Network
#10 · 16y ago
AeroMan
AeroMan
Good tut mate
#11 · 16y ago
radnomguywfq3
radnomguywfq3
Mmz, some invalid information but I'll let it fly because I'm not a dick.

The EP of a program is 'main' symbol at default for the Console subsystem, but you can change the arguments passed to the linker and make it something else. The entry point name and parameters also change when you use other subsystems, such as Native(for kernel drivers) or the Windows subsystem.

I can't find anything else wrong really, but I haven't read it all to be honest. Just the last part where you suggest you replace the return with cin.get() is a bad idea. Compilers will throw a warning because if the called routine doesn't return with a specified value, then the return value is undefined. As the return will be whatever is loaded in the eax register[well actually, that depends on the calling convention. But assuming you're using stdcall or cdecl], which could have been altered by the caller or the callee.

Anyway, a good way to remember what you've just learned is to make a tutorial regarding it. Just don't be offended when I come along and make a few corrections.

Thanks for posting it.
#12 · 16y ago
SA
sawm444
Jetamay is write on that should not replace return 0; :3 if your using PC and don't plan on making anything for mac or other OS you could add #include <windows.h> and use system("PAUSE"); or Sleep(9000); (9000 is just an example its in milliseconds btw) ( not usually suggested because its not standard c++ but i guess too start off why not there's an infinite amount of ways to stop your program

EDIT


by curiosity whats wrong with using 2 cout's instead of 1? i mean not in this case.. if you intended too make it in 1 sentence id suggest you put it in 1. I don't see why you would call it up 2 times but yea how taboo is using 2 cout's really? lets say some one had 200 lines to write down in cmd would it make any difference if he wrote it all in a single cout with \n\t ect... or would it be just as fast too execute 50 cout's. Sorry if this doesn't make sense...its 4:27 and i was bored working on a mini CMD side shooter and wondered if it would alter the performance of my "game" ( speed lag wise ) D:<
#13 · edited 16y ago · 16y ago
HO
hobosrock696
Uhhhh is it just me or doesnt cin.get(); no longer pause after using cin before it? Also this tutorial truthfully is underwhelming... You basically MAYBE taught someone how to print to screen.... This tut (and ones like it) are the reason mpgh has many leaches.... truthfully after reading this all I would be able to do is write that program or change the txt it displays and IF I had read the entire thread I would know endl;

Just saying for the skill level this tutorial is targeted at its not exactly sufficient...

Nontheless thank you for a contribution to our community and at least an attempt at educating the FR00BZ0RS
#14 · 16y ago
KR
Krypton1x
Eh, can someone edit my post, I misspelled iostream in the first code. :/
#15 · 16y ago
Posts 1–15 of 17 · Page 1 of 2

Post a Reply

Similar Threads

  • Type of hacks, and what they do.By radnomguywfq3 in WarRock - International Hacks
    12Last post 18y ago
  • Every Rez Files And What They ControlBy Corndog in Combat Arms Mods & Rez Modding
    77Last post 16y ago
  • Call of Duty 4 graphic settings and what they do.By CJwarrior in Call of Duty 4 - Modern Warfare (MW) Hacks
    5Last post 15y ago
  • MW2 Perks and what they do.By A⁴ in Call of Duty Modern Warfare 2 Discussions
    3Last post 16y ago
  • [REQUEST] list of .dtx or .****b files and what they controlBy eddiecai64 in Combat Arms Mod Request
    9Last post 16y ago

Tags for this Thread

None