FINDING HEXADECIMAL NUMBER CPP SOURCE CODE

/*HEXADECIMAL.CPP*/
#include "calculator.h"
#include <iostream>
using namespace std;
void ScientificCalculator::hexadecimal()
{
 long int binaryvalue, hexadecimalvalue = 0, i = 1, remainder;
    cout<<"Enter the binary number: ";
    cin>>binaryvalue;
    while (binaryvalue != 0)
    {
        remainder = binaryvalue % 10;
        hexadecimalvalue = hexadecimalvalue + remainder * i;
        i = i * 2;
        binaryvalue = binaryvalue / 10;
    }
    cout<<"Equivalent hexadecimal value: "<<hexadecimalvalue;
}

Comments

Popular posts from this blog

Scientific Calculator Project Proposal