Uppercase the vowels

I have to take the input user string, and uppercase the vowels and display it back.

EX: Enter your fullname: Barack Obama
output: bArAck ObAmA




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 	char c;
	

	cout << "Enter your full name: " << endl;
	cin.get(c);

	while (c != '\n')
	{
		if (c == 'a' || c == 'A' || c == 'e' || c == 'E' || c == 'i' || c == 'I' || c == 'o' || c == 'O' || c == 'u' || c == 'U')
			toupper(c);
		
		
		cin.get(c);
	}



How do I display the full string back?
line 10: change to c = toupper(c)
line 11: change to std::cout << c;
Ah ok, does toupper work on its own or does it have to be assigned to a variable?
When in doubt, check the reference:
http://www.cplusplus.com/reference/cctype/toupper/
http://en.cppreference.com/w/cpp/string/byte/toupper

I recommend you to note that parameter is passed by value (so it cannot be changed)
Last edited on
Topic archived. No new replies allowed.