Design a program that converts a decimal number into hexadecimal number without an array. Use a constructor.
For example 16(10)=>10(16)
Testing this
//Code testing to replit online compiler
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
//decimal to hex
long numDecimal;//Number Decimal
cout<<"Please enter number:";
cin>>numDecimal;
cout.setf(ios::hex|ios::uppercase);//Use UpperCase
cout<<"To Hex:="<<hex<<numDecimal<<endl;
return 0;
}
Comments
Leave a comment