Replacing capital letters with lowercase letters
I tried the code below and it does not budge although it compiles
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
|
#include <iostream>
using namespace std;
void mess(char[]);
int main()
{
char stuff[] = "Tom Talbert Tried Trains";
cout << stuff << endl;
mess(stuff);
cout << stuff << endl;
cin.get();
return 0;
}
void mess(char str[])
{
int step = 0;
while (str[step] != '\0')
{
if (str[step] == 'T')
tolower(str[step]);
step++;
}
}
|
Replace lines 22 and 23 by
str[step] = tolower(str[step]);
You have to actually use the character returned by tolower().
Topic archived. No new replies allowed.