C Strings Replacing

Trying to replace every occurrence of the character c in the string s with the uppercase character of c. Doesn't seem to work, please help thank you.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;

char string_replace(char *s, char c){
    for (int i; i < s[25]; i++){
        if (c = s[i]) {
        s[i] = toupper(s[i]);
        }
    }
    return c;
}

int main () {
    char upper[25];
    char C;
    cout << "Enter a string with characters including 'c' to be changed." << endl;
    cin >> upper;
    string_replace(upper, C);
    cout << "Replaced: " << upper << endl;
    return 0;
}
"=" vs "=="

take a look at what you are have done on line 8
Topic archived. No new replies allowed.