User Tools

Site Tools


haas:fall2011:cprog:projects:bases

Base Conversions

In Computer Essentials (and other classes), time was spent converting numbers between various bases. In such environments, this valuable process typically was a very tedious endeavor performed by hand for the purposes of learning the concepts. Now, let us revisit it with the intention of having the computer do this work for us.

Your task with this project is to implement a program that will:

  • accept as input both a source and destination base
  • utilize arrays to store (and display) the values
  • utilize loops to assist you in calculations and array manipulation/access, and output
  • have a tobase() function that converts from the source base to destination base
  • have a frombase() function that converts from the destination base to the source base
  • valid bases your program must operate with are base 2 through base 36 (inclusive). For clarification, use the uppercase alphabet (A-Z) for all numeric values over 9. For example, base 36 is 0-9A-Z.
  • have a display() function that, in nice columnar format, displays in the destination base the first 256 (base 10 quantity) values– think 16(10) x 16(10)
Attributes
arrays, functions, repetition

Other attributes can be achieved in this project- make a case for the ones you'd like to receive.

The following are suggested extensions to the core project requirements that would assist you in better achieving some attributes:

  • use pointer arithmetic on the arrays for all manipulations/accesses (pointers)
  • use command-line arguments to receive program operating parameters; validate the data (pointers, selection)
  • accept additional parameters to the program to adjust final display to adjust rows, columns (I/O)
  • open a file to read parameters, write parameters to a new file, or append to original file (file I/O)
  • extend your program to check if numbers in the range are prime or composite, use sqrt() function to assist (selection, libraries)
haas/fall2011/cprog/projects/bases.txt · Last modified: 2011/08/21 15:48 by 127.0.0.1