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 › How to use "double" ( you can use numbers like 5.4) in your programs.

How to use "double" ( you can use numbers like 5.4) in your programs.

Posts 1–8 of 8 · Page 1 of 1
Ronon666
Ronon666
How to use "double"? ( you can use numbers like 5.4) in your programs?
Hey, i know that you can use double in java but what about an double or somthin like that in c++.
Im currently making a converter(If you can call it that) and since it is my 2nd program i find it pretty awesome.

So its like 25mm2 = 0cm2 but i want it to be

25mm2 = 0.25cm2

so what do i have to type to get that 0.25cm as an answer.

Code:
 #include <iostream>
int main()
{
using namespace std; 
int num, num2, num3 , num4, num5, mynumber;
cout << "Enter the number you want to square: (im going to think that its a mm)";
cin >> num;
cout << "Really? O.o you dont have the brain to square it yourself? fine than... press any key to see the answer." << endl;
system("pause");
num2 = num * num;
cout << " Here you go you lazy monkey: " << endl;
cout << num;
cout << " mm = ";
cout << num2;
cout << "mm2" << endl;
cout << num2;
cout << " mm2 = ";
num3 = num2 / 100;
cout << num3;
cout << "cm2" << endl;
cout << num3;
cout << " cm2 = ";
num4 = num3 / 100;
cout << num4; 
cout << "dm2" << endl;
cout << num4;
cout << " dm = ";
num5 = num4 / 100;
cout << num5;
cout << "m2" << endl;
cout << num5;
cout << " m2 = ";
mynumber = num5 / 100;
cout << mynumber;
cout << "km2" << endl;
system("pause");
return 0;
}
Thats my code, how can i make it so it gives me 0.25 instead of 0.
#1 · edited 15y ago · 15y ago
'Bruno
'Bruno
You are saving the result to a int type variable... Save it to a double/float type.

Check this:
http://www.exforsys.com/tutorials/c-...ata-types.html
#2 · edited 15y ago · 15y ago
Ronon666
Ronon666
i did not understand you correctly. I tried to use double instead of int but than it gave me errors
#3 · 15y ago
'Bruno
'Bruno
Quote Originally Posted by Ronon666 View Post
i did not understand you correctly. I tried to use double instead of int but than it gave me errors
Instead of

Code:
int num, num2, num3 , num4, num5, mynumber;
use

Code:
double num, num2, num3 , num4, num5, mynumber;
and your code should work just fine.
#4 · 15y ago
Ronon666
Ronon666
Quote Originally Posted by Brinuz View Post
Instead of

Code:
int num, num2, num3 , num4, num5, mynumber;
use

Code:
double num, num2, num3 , num4, num5, mynumber;
and your code should work just fine.
Okey thx, i tried to use it before myself but it gave me an error. Gonna see if it works now.

O.o im confused, it didnt work earlier but it did now, well i must have made a typo somewhere. mhm there are still some fails in my program, the maximum length or W/E you call that in english can be max 999mm (Gonna make it the other way so max will be 999km so its something thats worth posting)

O.o this program is a failure unless theres a way to show the correct number, (If the number is too big it shows e+ at the middle of the number deleteing some numbers from the answer)
Is there a way? since currently if i would do it with mm at the starting number the max you would be able to enter is 999 but even if i type 0.1 while km is the starting one it still shows e+ .
#5 · edited 15y ago · 15y ago
Pxpc2
Pxpc2
Code:
#include <iostream>
using namespace std;

int main () {
double f;
     double m;

           cout << "Enter the length in feet:  ";
           cin >> f; // thats reading the number of f (feet)

           m = f / 3.28; // "converting" (soz my english is bad haha)
           cout << f << " feet is " << m << "meters.";

           return 0;
}
That would create a program that could convert feet into meters, thats pretty easy to create, and a good example of Double, if you can see I used Double instead of int for ammount of feet like 4.9, 4.5 feet etc...

So thats how you use double, and already gave a good example of a simple conversation for you so this could help in your program..

Sorry for syntax errors if you get cause im not coding in c++ anymore, im using Java.

Also sory for spelling errors cause my english is not sooooo good.
#6 · 15y ago
Ronon666
Ronon666
Dude. this thread is like OLD. I have advanced alot further than this. now i need help with other problems xD.
#7 · 15y ago
Pxpc2
Pxpc2
Quote Originally Posted by Ronon666 View Post
Dude. this thread is like OLD. I have advanced alot further than this. now i need help with other problems xD.
Im sorry and no need to be rude.

You should have alreayd requested a close.
#8 · 15y ago
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Tags for this Thread

None