// string-loop
#include <iostream>
using namespace std;
int main()
{
string name;
cout << "Enter a name: ";
getline(cin, name);
// Remove all occurrences of h/w/H/W from string
for(int i = 0; i < name.size(); )
{
cout << "Considering i=" << i
<< ": " << name.at(i) << endl;
switch(name.at(i))
{
case 'h': case 'w':
case 'H': case 'W':
//cout << "*** BAM ***\n";
name.erase(i,1);
break;
default:
i++;
}
}
cout << name << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
string name = "Rodolfo";
// Convert to upper case, one char at a time.
for(int i = 0; i < name.size(); i++)
{
name.at(i) = toupper(name.at(i));
}
cout << name << endl;
return 0;
}