Kat H.

asked • 04/27/21

All To Upper. Read a string from cin into word and modify it so that it has all uppercase letters.

Read a string from cin into word and modify it so that it has all uppercase letters.


Samples:

Input: hello Output: HELLO
Input: h3Llo Output: H3LLO



Hints:

  1. You can only change the code in the middle of this program - where it says YOUR_CODE.
  2. There is no magic "capitalize them all" - you need to loop through each character and convert each to uppercase.
  3. There is already code (that you can't change) to print out the word. Your job is to change the word, not print anything out yourself. (Though printing out extra info while debugging may be helpful)


Code:


#include <iostream>

#include <cctype>

using namespace std;


int main()

{

string word;


//Do not modify anything on or above the line below this

//YOUR_CODE_BELOW


//YOUR_CODE


//YOUR_CODE_ABOVE

//Do not modify anything on or below the line above this


cout << word;

}

1 Expert Answer

By:

Patrick B. answered • 04/27/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.