I need help with an assigment - I am to create a number systems table which consist of converting a decimal number to binary, octal, and hexadecimal. Here is my code i have so far but does not create output - any suggestions would be great - thanks
#include <iostream>
#include <string>
using namespace std;
int main()
{
int num = 0; //loop count for binary numbers
int fact = 256; //factor for binary values
double dec = 0.00;
int bin;
int oct;
int hex;
cout << "Decimal\t\t" << "Binary\t\t" << "Octal\t\t" << "Hexadecimal" << endl;
dec = k;
cout << k;
for (k = 1; k <= 256; k++)
num = k;
if (num = 256)
cout << '1';
else
cout << '0';
do{
if (num < fact && num >= fact / 2)
cout << '1' << endl;
else
cout << '0' << endl;
fact = fact / 2;
num = num % fact;
while (fact > 1);
}
cout << "\t\t\t\t" << k;
cout << "\t\t\t\t\t\t" << k;
return 0;
}