Scanning each character of a String

I'm trying to make something that:
prints only the uppercase letters
prints every second letter
replaces all vowels with underscores
finds the number of vowels
and the position of every vowel.

Problem is I'm not entirely sure where to start

What I'd like to know is:
how can I scan each character in a string?
how do I replace characters within the string?
and how do I find what position a certain character is within a string?

The only thing I've figured out is how to count how many letters are in a string.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream>
#include <string>
#include <cctype>
#include <sstream>

using namespace std;

bool isvowel(char c)
{
	c = tolower(c);
	if(c == 'a') return true;
	if(c == 'i') return true;
	if(c == 'u') return true;
	if(c == 'e') return true;
	if(c == 'o') return true;

	return false;
}

int main()
{
	int i;
	string word;
	string theString;
	cout << "Please enter a string : "; getline(cin, theString);

	cout << "Uppercase letters : ";
	for(i = 0; i < theString.size(); i++)
	{
		if(theString[i] == ' ') cout << ' ';
		else if(isupper(theString[i])) cout << theString[i];
	}
	cout << endl;

	cout << "Every second letter : ";
	stringstream ss;
	ss << theString;
	while(ss >> word)
	{
		if(word.size() >= 2) cout << word[1];
		cout << ' ';
	}
	cout << endl;

	cout << "Replaces all vowels with underscores : ";
	for(i = 0; i < theString.size(); i++)
	{
		if(isvowel(theString[i])) theString[i] = '_';
		cout << theString[i];
	}
	cout << endl;

	cin.get();
	return 0;
}


Please enter a string : The dog is lazy, and the cat is dangerous

Uppercase letters : T
Every second letter : h o s a n h a s a
Replaces all vowels with underscores : Th_ d_g _s l_zy, _nd th_ c_t _s d_ng_r__s

http://cpp.sh/83ee
Wow you really went above and beyond and did the whole thing for me,

Thanks.
Topic archived. No new replies allowed.