Your Raptor program (flowchart) should:
1. Input a string representing a C++ hexadecimal literal.
2. Check that the input is a valid hexadecimal number. Valid numbers start with 0x and are followed by either digits (0-9) or uppercase letters (A-F). For this assignment, lowercase numbers are considered invalid.
3. If the string is an invalid hexadecimal number, display a message indicating that and terminate the program. Otherwise, output the next hexadecimal number as a C++ literal.
Below is an example of a string in Raptor. Use this for reference.
Hints:
1. The next hex digit after 9 is A. The next hex digit after F is 0, but then 1 must be added to the preceding digit.
2. Start at the end of the string, increment the last character, then work toward the front incrementing characters as needed. This requires a loop.
3. Lesson #9 has an example of working with strings in Raptor.
Sample Output (inputs in bold)
Please enter a hexadecimal literal 0x3B
The next hexadecimal number is 0x3C
Please enter a hexadecimal literal 0x12z
That is not a valid hexadecimal number
Please enter a hexadecimal literal 0xC4F
The next hexadecimal number is 0xC50
Please enter a hexadecimal literal 0xD69
The next hexadecimal number is 0xD6A
Please enter a hexadecimal literal 0xFFFFFF
The next hexadecimal number is 0x1000000
Please enter a hexadecimal literal 0x5d4
That is not a valid hexadecimal number
Chapter 10 Programming Challenge 14: This program inserts spaces between the words in a string. Each word in the string starts with an uppercase letter.
Start
"Please enter the compressed sentence." GET sentence
separated + sentence[1]
The separated string starts with the first letter of the sentence's index
Loop
index > Length_Of(sentence)
NO
sentence[index] 'A' && sentence[index] = Z
Check for uppercase
seta com
separated separated -
sentence[index] sentence[index] + ('a' - 'A')
Convert to lowercase
+ pajeredes > pasodes sentence[index]
index index + 1
PUT *The sentence with the words separated is - " + separated
End