Create a function that will accept one parameter, a string. Based on the string provided, convert it into an acronym and print both the string and the acronym in the browser. For example:
laugh out loud = LOL
The quick brown fox jumped over the lazy dog = TQBFJOTLD
Regardless of the case of the string the user provides (lowercase, title case, etc.), the acronym should be returned in all uppercase letters.
Hint: You can use the substr() function which returns a portion of a string specified by start and length parameters
If you have any doubts, please give me comment...
#include <iostream>
#include <string>
#include <sstream>
#include <cctype>
using namespace std;
string acronym(string str);
int main() {
cout << acronym("laugh out loud") << endl;
cout << acronym("The quick brown fox jumped over the lazy dog") << endl;
}
string acronym(string str) {
istringstream ss(str);
string word, result="";
while(ss>>word){
result += toupper(word[0]);
}
return result;
}

Create a function that will accept one parameter, a string. Based on the string provided, convert...
‘C’ programming language question Write a MENU DRIVEN program to A) Count the number of vowels in the string B) Count the number of consonants in the string C) Convert the string to uppercase D) Convert the string to lowercase E) Display the current string X) Exit the program The program should start with a user prompt to enter a string, and let them type it in. Then the menu would be displayed. User may enter option in small case...
10. replaceSubstring Function Write a function named replaceSubstring. The function should accept three C-string or string object arguments. Let's call them string1, string2, and string3. It should search string for all occurrences of string2. When it finds an occurrence of Programming Challenges string2, it should replace it with string. For example, suppose the three arguments have the following values: stringt: "the dog jumped over the fence" string 2 "the" string3: "that" With these three arguments, the function would return a...
Hi, need this question ansered in c++, has multiple levels will
post again if you can complete every level so keep an eye out for
that.
here is a sketch of the program from the screenshot
int main (int argc, char** argv) { enum { total, unique } mode =
total; for (int c; (c = getopt(argc, argv, "tu")) != -1;) {
switch(c) { case 't': mode = total; break; case 'u': mode = unique;
break; } } argc -=...
You will be writing a simple Java program that implements an ancient form of encryption known as a substitution cipher or a Caesar cipher (after Julius Caesar, who reportedly used it to send messages to his armies) or a shift cipher. In a Caesar cipher, the letters in a message are replaced by the letters of a "shifted" alphabet. So for example if we had a shift of 3 we might have the following replacements: Original alphabet: A B C...