Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// NOTE: The ONLY files that should be #included for this assignment are iostream, vector, and string // No other files should be #included #include

// NOTE: The ONLY files that should be #included for this assignment are iostream, vector, and string

// No other files should be #included

#include

#include

#include

// NOTE: The ONLY files that should be #included for this assignment are iostream, vector, and string

// No other files should be #included

using namespace std;

// Converts any UNsigned binary number to decimal

int bin_to_dec(string s)

{

//INPUT(S) : an UNsigned binary number as a string(e.g., 10110001)

//RETURN(S) : the binary number converted to the equivalent decimal number

//PURPOSE : Converts any UNsigned binary number to decimal

}

//Converts any non-negative decimal number to binary

string dec_to_bin(int n)

{

//INPUT(s) : A non - negative decimal number(e.g, 15)

//RETURN(S) : The decimal number converted to the equivalent binary number(as a string)

//PURPOSE : Converts any non - negative decimal number to binary

}

//Converts any UNsigned hexadecimal number to decimal

int hex_to_dec(string s)

{

//INPUT(S) : an UNsigned hexadecimal number as a string(e.g., FABC)

//RETURN(S) : the hexadecimal number converted to the equivalent decimal number

//PURPOSE : Converts any UNsigned hexadecimal number to decimal

}

//Converts any non-negative decimal number to hexadecimalConverts any non-negative decimal number to hexadecimal

string dec_to_hex(int n)

{

//INPUT(s) : A non - negative decimal number(e.g, 15)

//RETURN(S) : The decimal number converted to the equivalent hexadecimal number(as a string)

//PURPOSE : Converts any non - negative decimal number to hexadecimal

}

int main()

{

cout<<"10000011 binary = "<

cout<<"01010101 binary = "<

cout<<"1111111111111111 binary = "<

cout<<"0111111111111111 binary = "<

cout<<"255 decimal = "<

cout<<"65532 decimal = "<

cout<<"12 decimal = "<

cout<<"1000000 decimal = "<

cout<<"ABC hexadecimal = "<

cout<<"F5 hexadecimal = "<

cout<<"1234 hexadecimal = "<

cout<<"FDECB hexadecimal = "<

cout<<"512 decimal = "<

cout<<"5000 decimal = "<

cout<<"900000 decimal = "<

cout<<"65525 decimal = "<

system("PAUSE");

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions