Write a C++ program which declares a 5 x 10 characterarray, prompts the user to enter string literals (consisting of only alphabets) into this array and counts the value of each string (row). For counting value of strings, assume a/A=1, b/B=2.....z/Z=26. For instance, if the string at row 0 is ‘hello’, it’s value should be calculated as (h = 8) + (e = 5) + ( l = 12) + (l = 12) + (o = 15) = 52. Once the values have been calculated, your program should print the string with the highest value on screen.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

Write a C++ program which declares a 5 x 10 characterarray, prompts the user to enter string literals (consisting of only alphabets) into this array and counts the value of each string (row). For counting value of strings, assume a/A=1, b/B=2.....z/Z=26. For instance, if the string at row 0 is ‘hello’, it’s value should be calculated as (h = 8) + (e = 5) + ( l = 12) + (l = 12) + (o = 15) = 52. Once the values have been calculated, your program should print the string with the highest value on screen.

Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Array
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning