Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CODE IN C++ Words of Importance A former president wanted to make their mark by transforming the way we determine the importance of words by
CODE IN C++
Words of Importance A former president wanted to make their mark by transforming the way we determine the importance of words by emphasizing vowels including 'y'! When comparing two words, each word is given a weight. - A word receives three points every time a vowel is compared to a consonant. - A word receives one point when comparing two vowels or two consonants if its character is greater than the other in the traditional sense. - If one word has a vowel and the other has no character, then the word gets two points. - If one word has a consonant and the other has no character, then one point is added. - If both words have the same character, then no points are assigned. The word with the most points is more important. Write a function that takes in two C-Strings and returns 1 if the first word is more important than the second and returns 2 if the second word is more important and returns 0 otherwise. Examples - morelmportant("eel", "the") returns 1. - morelmportnat("the", "eel") returns 2. - morelmportant("angelic", "mistrust") returns 2. - morelmportant(spy", "ill") returns 1. - morelmportant("ill", "spy") returns 2. - morelmportant(trust", "silly") returns 2. - morelmportant("see", "sea") returns 1. Note: this is case insensitive comparison. The toupper() and tolower() functions can helpStep 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