This is a kind of C++ game I'm interested in you developing. The game is called "Four is the perfect number."
When the program starts, it will say "Enter a number: ". When the user enters a number, the program should count how many letters are in the word for that number in the background, and save that over the variable. Then repeat. All numbers will reduce to four by the end. For example, 3 is spelled "three" and has 5 letters. 5 is spelled "five" and has 4 letters. 4 is spelled "four" and has 4 letters.
This program will NOT convert numbers to their word form. This simply counts and adds with loops.
Here is an example run:
--
Enter a number: 11
11 is 6
6 is 3
3 is 5
5 is 4
4 is 4
Play again? (y/n)
--
The variable type should be a "long long int". If the user enters a number greater than one quadrillion or less than negative one quadrillion, the program will output "Please enter a number between -1,000,000,000,000,000 and 1,000,000,000,000,000." If the user enters commas with their number, the commas will be stripped out in the stored variable, and then be added back in for the numbers in the output.
One way I think this program could be accomplished is by setting loops for the different number groups and names. For example, if the user enters the number 12,050,000,742 the program will check each group of numbers separately. The program detects the first number in the billion group. It reads nothing from in the "hundred billions" place, so it ignores that place. It reads the 1 which would be "ten" but the because the "one billions" place has a 2, it changes to "twelve", making the total string for that group "twelve billion". The program will also count spaces, and there should be a space counted between every group being used. Next, the program would check the millions place, and it sees 50, so the string for that group would be "fifty million". The program now checks the thousands place, but because the value for this group is 0, is skips over the group. And last the program looks at the first (lowest) group, and sees 742. The string for this would be "seven hundred forty two". So the entire string for this number would be "twelve billion fifty million seven hundred forty two" 12,050,000,742. The program would output this:
--
Enter a number: 12,050,000,742
12,050,000,742 is 52
52 is 9
9 is 4
4 is 4
Play again? (y/n)
--
If the user uses a negative number, the string for "negative " would be added to the front including the space, which would add 9 to the total count. Example: -8 is "negative eight" which is 14. 14 is "fourteen" which is 8. 8 is "eight" which is 5. 5 is "five" which is 4. Example output:
--
Enter a number: -8
-8 is 14
14 is 8
8 is 5
5 is 4
4 is 4
Play again? (y/n)
--
If the entire number is 0, then the string is "zero". Example output:
--
Enter a number: 0
0 is 4
4 is 4
Play again? (y/n)
--
Also, 0 cannot be negative, so -0 will not add "negative ". Example output:
--
Enter a number: -0
0 is 4
4 is 4
Play again? (y/n)
--
Please let me know if you have any questions. I'm happy to help clarify. Thanks! :)
Hello, I am experienced and specialized in C and C++ programing. I have taken part in many competitions, including national competition, in which I won 2nd prize. I always work with responsibility and quality. Please contact me for details and time required, I will finish the job within time required. Thank you!
I'm an experienced C ++ programmer I want to take this job. I can give examples of my works. This is mainly complex applications from the field of turbine construction. I'm sure you will enjoy dealing with me.
have advanced knowledge of C ++, the project would be a pleasure to do so, it would be a cinch to demonstrate my skills can show a game of monopoly in fact pure c ++ console.
if you have any questions please write me a private message. Cheers