An acronym is a word formed from the initial letters of words in a set phrase. Define a function named CreateAcronym that takes a string parameter and returns the acronym of the string parameter. Append a period (.) after each letter in the acronym. If a word begins with a lower case letter, don't include that letter in the acronym. Then write a main program that reads a phrase from input, calls CreateAcronym() with the input phrase as argument, and outputs the returned acronym
5.13 LAB: Acronyms
An acronym is a word formed from the initial letters of words in a set phrase. Define a function named CreateAcronym that takes a string parameter and returns the acronym of the string parameter. Append a period (.) after each letter in the acronym. If a word begins with a lower case letter, don't include that letter in the acronym. Then write a main program that reads a phrase from input, calls CreateAcronym() with the input phrase as argument, and outputs the returned acronym. Assume the input has at least one upper case letter.
Ex: If the input is:
Institute of Electrical and Electronics Engineersthe output should be:
I.E.E.E.The program must define and call a function:
string CreateAcronym(string userPhrase)
Hint: Use isupper() to check if a letter is upper case.
I try the function void CreateAcronym (char [], char[]). I need another solution with string CreateAcronym(string userPhrase). Appreciate it so much if you can solve it.
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
/* Define your function here */
int main() {
/* Type your code here */
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images