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 › Learn how to code C++ || Day 4 - Input and Modifying Variables

Learn how to code C++ || Day 4 - Input and Modifying Variables

Posts 1–4 of 4 · Page 1 of 1
P0
P0SEID0N
Learn how to code C++ || Day 4 - Input and Modifying Variables
Lesson #4 - Input and Modifying Variables

In my last tutorial you learned about variables and how to output them. But what happens if we want the user of the program to tell us what numbers or letters our variable is going to hold? This is where input comes in handy.

The format for input is very much the same as the format for output.
Instead of cout we use cin (console out console in pretty simple really)

Lets say we have the integer variable dog and we want the user to input what the value of dog is going to be. We would do that like this:
[PHP]
cin >> dog;
[/PHP]
Notice the arrows, instead of pointing left point right. If you are having trouble remembering which direction is in and which direction is out just make up something to help you. The one i used was, the right arrow points at the door which leads out of the room, the left arrow points to inside the room.

Modifying Variables

Lets say hypothetically the value of dog is 3. What happens if you want to change the value of dog to something else6, AFTER it has been declared, without having the user to input it.
All you have to do is
[PHP]
dog = 6;
[/PHP]
Now lets say you have the variables, cat, dog and mouse. You wish to make mouse equal cat plus dog. All you have to do is
[PHP]
cat + dog = mouse;
[/PHP]
This works the same when outputting. If you wish to output cat + dog then
[PHP]
cout << cat + dog;
[/PHP]
The symbols for operations are:
+ Equals Plus
- Equals Minus
* Equals Times
/ Equals Divide


Now lets use all this in a program.

Code:
#include <iostream>
using namespace std;
int number1;
int number2;
int main()
{
cout << "please input number one" << endl;
cin >> number1;
cout << "please input number two" << endl;
cin >> number2;
cout << "number one plus number two is " << number1 + number2 << endl;
cout << "number one minus number two is " << number1 - number2 << endl;
cout << "number one times number two is " << number1 * number2 << endl;
cout << "number one divided by number two is " << number1 / number2 << endl;
return 0;
}
Credits:
Me :]
#1 · 16y ago
KI
killashoota1
It seems a little short. It could have more information in it. I just wouldnt want it to take like 2 months to learn something that i could learn in about 2-3 weeks somewhere else. But good tuts. Thats the only reason I wouldnt say i absolutely love it
#2 · 16y ago
P0
P0SEID0N
Yea this one is pretty short, its kind of just doing the fine points/recap of what they have already learnt. As some people were getting confused I didn't add all the modulo and stuff in..
#3 · 16y ago
why06
why06
Quote Originally Posted by killashoota1 View Post
It seems a little short. It could have more information in it. I just wouldnt want it to take like 2 months to learn something that i could learn in about 2-3 weeks somewhere else. But good tuts. Thats the only reason I wouldnt say i absolutely love it
1. Buy a book
2. cplusplus.com
3. sticky: http://www.mpgh.net/forum/31-c-c/481...ter-guide.html

All good ways to get started. I like P0SIEDAN's tuts too, but for me nothing beats a book, but learn whichever way you want to. If you want to learn to code learn to code for other reason's then hacking, cuz its a long process, and u won't go through with it unless ur tunnel-visioned like myself. xD
#4 · 16y ago
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

  • Learn how to code C++ || Day 4 - Input and Modifying VariablesBy P0SEID0N in CrossFire Hack Coding / Programming / Source Code
    0Last post 16y ago
  • Learn how to code C++ || Day 3 - Variables and Date TypesBy P0SEID0N in C++/C Programming
    5Last post 16y ago
  • Learn how to code C++ || Day 3 - Variables and Date TypesBy P0SEID0N in CrossFire Hack Coding / Programming / Source Code
    8Last post 16y ago
  • Learn how to code C++ || Day 1 - CompilerBy P0SEID0N in CrossFire Hack Coding / Programming / Source Code
    14Last post 16y ago
  • Learn how to code C++ || Day 1 - CompilerBy P0SEID0N in C++/C Programming
    5Last post 16y ago

Tags for this Thread

None