a program to decipher a numeric code in C++.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Write a program to decipher a numeric code in C++.
After years of searching, your team has uncovered a code that could unlock ancient secrets. Based on their
research, they have determined the integer 67,796,869 could be the key to the mysteries. The team is certain
that the number is a sequence of 2-digit pairs, where each pair represents a letter. They need your help to
write a program which displays the decoded message.
After your analysis, you realize that you can use the modulus (%) to split off the last 2 digits and store it as a
number. Then, you can convert (static_cast) the number to a character. Since there are 8 digits in the number,
that means the message will have 4 letters (so you need 4 char variables, c1, c2, c3, c4), and you will have to
"split" more than once.
Once you have all 4 characters, display them (in order) to the user (The secret message is.)
The program should:
• contain header comments as shown in class
• display a "hello" message
• store the original number as a constant integer
• store the divisor as a constant integer
• split the number 2 digits at a time using % and /
• cast each 2-digit pair to a character variable
• display the decoded message
• display a "goodbye" message before exiting the program
HINT: Create two additional integer variables, one to hold the quotient (after /) and one to hold the remainder
(after %).
Transcribed Image Text:Write a program to decipher a numeric code in C++. After years of searching, your team has uncovered a code that could unlock ancient secrets. Based on their research, they have determined the integer 67,796,869 could be the key to the mysteries. The team is certain that the number is a sequence of 2-digit pairs, where each pair represents a letter. They need your help to write a program which displays the decoded message. After your analysis, you realize that you can use the modulus (%) to split off the last 2 digits and store it as a number. Then, you can convert (static_cast) the number to a character. Since there are 8 digits in the number, that means the message will have 4 letters (so you need 4 char variables, c1, c2, c3, c4), and you will have to "split" more than once. Once you have all 4 characters, display them (in order) to the user (The secret message is.) The program should: • contain header comments as shown in class • display a "hello" message • store the original number as a constant integer • store the divisor as a constant integer • split the number 2 digits at a time using % and / • cast each 2-digit pair to a character variable • display the decoded message • display a "goodbye" message before exiting the program HINT: Create two additional integer variables, one to hold the quotient (after /) and one to hold the remainder (after %).
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY