Kat H.

asked • 07/06/21

C++. Define a function RemoveUpper() that takes a string parameter and returns a string. The returned string is the parameter with all characters except the uppercase letters removed.

Define a function RemoveUpper() that takes a string parameter and returns a string. The returned string is the parameter with all characters except the uppercase letters removed.


Ex: RemoveUpper("vbWmVEGrL") returns "vbmr"


Recall string's size() returns the number of characters in a string. Ex: myString.size()


string's at() returns a character at the specified position in the string. Ex: myString.at(3)


isupper() checks if the character passed is uppercase. Ex: isupper('A') returns a non-zero value. isupper('a') returns 0.


Code:


#include <iostream>

#include <string>

#include <cctype>

using namespace std;


/* Your code goes here */




int main() {

string input;

string output;


getline(cin, input);

output = RemoveUpper(input);

cout << output << endl;


return 0;

}

1 Expert Answer

By:

Patrick B. answered • 07/07/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.