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 %).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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 %).

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education