Lab 8

Announcements

LAB 8 - Base conversion

  In today's lab we will practise base conversion from Binary to Decimal and Decimal to Binary.

 

 Tasks

Download the starter code Lab8Question.cpp and start working on that by following

the instructions below.

 Stage 0 - 1 point

 --------

 

 Complete the function convert4DigitBinaryToDec. This function takes in a 4 digit 

 binary number as a parameter and returns the decimal value of it. Code to read in

 the binary number and print the decimal output has already been set up for you. 

 You will only have to write code for the base conversion

 

  Stage 1 - 1 point

 --------

 Complete the function convertDigitToBin. This function takes in a single digit

 decimal number as a parameter and returns the binary value of it. Once again, code

 for reading in the decimal number and printing out the binary output has been written

 for you. You only have to write code for the conversion.

 

 Stage 2 - 1point

 ---------

 Complete the function convertIntToBin. This function takes in an integer between

 32 and 64 as a paramter and returns the binary value of it.

 

 Note : Feel free to change the data type of the parameters and return type of any of

 the functions as you wish.