0% found this document useful (0 votes)
6 views1 page

Number Conversion Program Steps

The document outlines an algorithm to convert numbers between binary, roman numerals, and hexadecimal. It describes 5 steps: 1) defining conversion functions, 2) declaring variables to store user input and results, 3) prompting the user for input and storing their responses, 4) validating the user input, and 5) outputting the results of the conversions and asking if the user wants to convert another number.

Uploaded by

api-690889230
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Number Conversion Program Steps

The document outlines an algorithm to convert numbers between binary, roman numerals, and hexadecimal. It describes 5 steps: 1) defining conversion functions, 2) declaring variables to store user input and results, 3) prompting the user for input and storing their responses, 4) validating the user input, and 5) outputting the results of the conversions and asking if the user wants to convert another number.

Uploaded by

api-690889230
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Jesus Torres

Eduardo Mendoza
Isaac Bernal
Juan Martinez
Programming Fundamentals I
10/24/2021
Algorithm

Step 1 - Function Prototypes


 define 3 functions to call upon
o int binaryFunction(int) - will have the binary number conversion
o string RomanNumerals(string) - will have the roman numeral conversion process
o int HexDecimal(int) - will have the hexadecimal conversion process

Step 2 - Variables
 create 3 variables to store our input
o num (int) - will hold the inputted number
o answerChoice (char) - will hold the character choice the user chooses when the
menu is displayed
o yesNo (char) - will hold the character choice the user chooses when asked if they
want to try again

Step 3 - Data Input


 Output a menu asking the user to enter one of the choices displayed
 Input the user data into answerChoice
 Output a message asking the user to input a number from 1-50
 Input the user data into the num variable

Step 4 - Data Validation


 If answerChoice is not one of the choices, output “Wrong input option”
 If num is not a number within the range, output “Wrong input number” and let user input
different number
 If yesNo is a ‘y’ or a ‘Y’, display menu once again

Step 5 - Output Results


 If the user chose ‘a’ or ‘A’, output ‘num’ as a roman numeral and a prompt asking the
user if they would like to convert another number.
 If the user chose ‘b’ or ‘B’, output ‘num’ as a binary number and a prompt asking the
user if they would like to convert another number.
 If the user chose ‘c’ or ‘C’, output ‘num’ as a hexadecimal and a prompt asking the user
if they would like to convert another number.
 If the user chooses ‘d’, output an exit prompt

You might also like