[Solved] BBM104 Quiz 5-Data Structure

30 $

SKU: [Solved] BBM104 Quiz 5-Data Structure Category: Tag:

Problem1: Display octal equivalents of decimal numbers

Write a main program that takes decimal numbers(between 1000-200000) from an input file (decimal.txt) as an argument and put them into any data structure, then finds and displays their octal equivalents by using a stack (octal.txt), i.e convert the number with base value 10 to base value 8.

Create a Stack class with:

  • One constructor
  • Push
  • Pop
  • Top
  • isFull()
  • isEmpty()
  • Size

You must use ONLY stack(s) for decimal-to-octal operation, don’t use other data structures such as normal array, string etc.

Algorithm:

  • Store the remainder when the number is divided by 8 into a stack.
  • Divide the number by 8 now
  • Repeat the above two steps until the number is not equal to 0.
  • Print the content now.

Figure 1: Representation of decimal-to-octal

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] BBM104 Quiz 5-Data Structure
30 $