CSCI 3080 - Discrete Structures

Bonus Lab - Binary, Decimal, Hexadecimal Converter

1. Objective

The goal of this lab is to create a C++ program that converts a number between three numbering systems: binary, decimal, and hexadecimal. Students will gain hands-on experience in base conversions and string manipulation.

2. Requirements

3. Sample Input/Output

--------------------------------
Number System Converter
--------------------------------
Choose input format:
1. Binary
2. Decimal
3. Hexadecimal
Enter your choice (1-3): 1
Please enter binary number: 11001110

Conversion Results:
--------------------------------
Binary:      11001110
Decimal:     206
Hexadecimal: CE

Do you want to convert another number? (y/n): y
--------------------------------
Number System Converter
--------------------------------
Choose input format:
1. Binary
2. Decimal
3. Hexadecimal
Enter your choice (1-3): 2
Please enter decimal number: 256

Conversion Results:
--------------------------------
Binary:      100000000
Decimal:     256
Hexadecimal: 100

Do you want to convert another number? (y/n): y
--------------------------------
Number System Converter
--------------------------------
Choose input format:
1. Binary
2. Decimal
3. Hexadecimal
Enter your choice (1-3): 2
Please enter decimal number: -19

Conversion Results:
--------------------------------
Binary:      11101101
Decimal:     -19
Hexadecimal: ED

Do you want to convert another number? (y/n): y
--------------------------------
Number System Converter
--------------------------------
Choose input format:
1. Binary
2. Decimal
3. Hexadecimal
Enter your choice (1-3): 3
Please enter hexadecimal number: FF6D

Conversion Results:
--------------------------------
Binary:      1111111101101101
Decimal:     65389
Hexadecimal: FF6D

Do you want to convert another number? (y/n): n

Thank you for using the converter!
--------------------------------

    

4. Grading Criteria

Grading Criteria (Total Points: 100)
Category Criteria Points
Base Input MenuDisplay base menu, read user choice10
Input ReadingInput number based on selected base5
Binary ConversionConvert to/from binary correctly20
Decimal ConversionConvert to/from decimal correctly20
Hex ConversionConvert to/from hexadecimal correctly20
Looping & MenuRepeat program using do-while loop10
Input ValidationCheck for correct base input5
CommentsIncludes meaningful and relevant comments explaining key parts of the code.5
A.I. DisclaimerIncludes a clear statement indicating whether AI tools were used and how they contributed to the assignment.5

5. Submit

Please submit your Lab X source code file: labx.cpp in D2L!

6. Comments

Bonus Opportunity! This lab is optional and can earn you up to 3 extra points.