Skip to content

Students need to understand what binary values are, and how to convert to other numerical bases. This lab will demonstrate how to convert data using the c language and binary, hexa, and octal conversion formulas..

Notifications You must be signed in to change notification settings

raziehyria/Converting-decimals-to-other-bases

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C Programming Lab

Convert Decimal to Hex, Binary, and Octal

Programming guidelines

  1. Create a comment header, at the top of the document.
  2. It must contain your name, the course (and semester)
  3. brief description of what the program does.
  4. Line up your braces
  5. Indent properly
  6. Use meaningful variable names.
  7. Make the code readable.

Program Requirements

The project shall be called: “ConvDecimal_to_OtherBases”.

Input

  1. Allow user to input an integer from 0 -> 2,000,000.
  2. Validate the input. If input is invalid, make them enter a value again (while), until they enter a valid value.

Processing

  1. Use the Division method for converting Decimal to Binary, and Hexadecimal, and Octal. ..1. Divide the quotient by 2 or 16 or 8, respectively. ..2. Get the remainder after dividing. Save the remainders. They are the answer.
  2. Display the answer with, the digits, in the proper order.
  3. Loop and ask user to input another positive integer.
  4. Stop looping and exit when the user enters “-1”.
  5. Create a function (and a corresponding .h file) named ConvDecimal().
  6. Make sure you store (and Add) this separate .cpp and .h file to your project.
  7. You will create 1 function that will convert Decimal to all 3 other bases (2, 16, and 8). You (the programmer) need to determine what the parameters should be for this function.
  8. This function will return nothing.

Output

  1. At beginning of the program, display some kind of welcome message, stating to the user what this program does.
  2. When printing the results, display both the original decimal value and the calculated values.
  3. Display the output in a nice format.
  4. Testing
  5. Extensively test your program. Test with all type of integers values; valid and invalid data.

About

Students need to understand what binary values are, and how to convert to other numerical bases. This lab will demonstrate how to convert data using the c language and binary, hexa, and octal conversion formulas..

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages