Question
Color Value for letters Letters Red 1 A J S Orange 2 B K T Yellow 3 C L U Green 4 D M V
Color | Value for letters | Letters |
---|---|---|
Red | 1 | A J S |
Orange | 2 | B K T |
Yellow | 3 | C L U |
Green | 4 | D M V |
Blue | 5 | E N W |
Indigo | 6 | F O X |
Violet | 7 | G P Y |
Rose | 8 | H Q Z |
Gold | 9 | I R |
Add the numbers associated with each letter of your name, and then reduce the total to a single digit by adding the digits of the sum. Continue reducing the sums until you get a sum that is a single digit (less than 10).
For example, Mary Jones would add M A R Y J O N E S
4+1+9+7+1+6+5+5+1
and get a sum of 39.
Then 3+9=12.
Since 12 is greater than 9, add its digits: 1+2=3
which corresponds with the yellow on the chart above.
Write a C++ program which will determine your supposed favorite color and then input names from the text file and determine what their favorite colors should be accoriding to this method. Output the names and the associated colors.
Input file: https://drive.google.com/open?id=1ikgbCVFu7IO-MWvMgCnq3JsQfalm2nKf The file contains a variable number of names with one name per line.
Requirements:
1. The table of colors, numbers, and letters must be implemented using at least one array. I don't expect anything more than a plain one-dimensional array(s).
2. Your name can be input from the keyboard, placed in a file, or defined as a named constant.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started