C++ HexCalculator Example
Code:
/*
Made by TheEliteOne
Language: C++
HexCalculator Example
Open Source
*/
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
system("cls");
system("title TheEliteOne's HexCalculator");
int num1, num2;
cout << "Input a hexadecimal number: 0x";
cin >> hex >> num1;
cout << "\nInput a hexadecimal number: 0x";
cin >> hex >> num2;
system("cls");
cout << "0x" << hex << num1 << " + 0x" << hex << num2 << " = 0x" << hex << num1 + num2 << "\n";
cout << "0x" << hex << num1 << " - 0x" << hex << num2 << " = 0x" << hex << num1 - num2 << "\n";
cout << "0x" << hex << num1 << " * 0x" << hex << num2 << " = 0x" << hex << num1 * num2 << "\n";
cout << "0x" << hex << num1 << " / 0x" << hex << num2 << " = 0x" << hex << num1 / num2 << "." << hex << num1 % num2 << "\n\n";
system("pause");
return main();
}
Re: C++ HexCalculator Example
Not bad. Real simple.
What I don't get is why do you put windows.h if your not making any type of forms or window.
Re: C++ HexCalculator Example
Quote:
Originally Posted by
j2eco7V
Not bad. Real simple.
What I don't get is why do you put windows.h if your not making any type of forms or window.
If you use Code::Blocks then you need to include windows.h if you use system commands such as system("pause"); and system("cls");
Re: C++ HexCalculator Example
Ohh ight. I didn't know. I have it installed, but I never used it. I usually use DevC++.
Re: C++ HexCalculator Example
Quote:
Originally Posted by
j2eco7V
Ohh ight. I didn't know. I have it installed, but I never used it. I usually use DevC++.
You should try Code::Clocks, it is better imo.
Re: C++ HexCalculator Example
Quote:
Originally Posted by
TheEliteOne
You should try Code::Clocks, it is better imo.
Well I actually haven't done anything in a long time. I've actually started to try and learn Zune Game and App development.