#include
#include
using std::cin;
using std::cout;
using std::endl;
using std::tolower;
inline void decToHexOct(unsigned int number, char base);
int main()
{
cout << endl << "Enter a number: ";
unsigned int number = 0;
cin >> number;
cout << endl << "Choose base:"
<< endl << "h//H for Hex"
<< endl << "o//O for Octal"
<< endl;
char base = 'h';
cin >> base;
decToHexOct(number, base);
system("PAUSE");
return 0;
}
inline void decToHexOct(unsigned int number, char base)
{
if (tolower(base) == 'h')
{
cout << endl << "Number in hex is: " << std::hex << std::showbase << number
<< endl;
}
else if (tolower(base) == 'o')
{
cout << endl << "Number in octal is: " << std::oct << std::showbase << number
<< endl;
}
else
{
cout << endl << "Wrong base...";
system("PAUSE");
exit(1);
}
}
18 (eighteen) is an integer and does not need to be "converted to a decimal"1/8 (one eighth) is a fraction and can be converted into a decimal: 0.125
Converted from decimal to binary, 123789 is equal to 11110001110001101.
38 is an integer, it does not need to be converted. 3/8 is a fraction, it is equal to 0.375
4111 is an integer and so there is no sensible way to convert it into a repeating decimal.
1 3rd converted to a decimal = 0.33333...1/3:= 1 ÷ 3= 0.33333... in decimal
3.68 is already a decimal and does not need to be converted.
18 (eighteen) is an integer and does not need to be "converted to a decimal"1/8 (one eighth) is a fraction and can be converted into a decimal: 0.125
Converted from decimal to binary, 123789 is equal to 11110001110001101.
To convert a percentage to a decimal, divide by 100: 12 % = 12 ÷ 100 = 0.12
The conversion of octal number to binary can be obtained by using two methods. First, it can be converted into decimal and then obtained decimal is converted into binary. In the second method
to convert a decimal to percent, multiply by 100. 0.02 = 2%
Decimals can only be converted into fractions if they are rational numbers
615 is a whole number and as such has no need to be converted to a decimal. It could be represented as 615. but it ends in a five and so the terminal decimal is meaningless.
A whole number is a number that is not a decimal or fraction. Since 0.02687 is a decimal, it cannot be converted into a whole number.
38 is an integer, it does not need to be converted. 3/8 is a fraction, it is equal to 0.375
NoImproved Answer:-Yes equivalent fractions can be converted into identical decimals.
4111 is an integer and so there is no sensible way to convert it into a repeating decimal.