American to Canadian english translation

it should translate american to canadian english for example color into colour, for shoud be for and if the user enter quit! the program shoud terminate.
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
#include <iostream>
#include <string>
using namespace std;

int main()
{
    char word[65];
    char j,k,l;
    int x;
    cout<<"enter the word :"<<endl;
    cin>>word;

    x=word.length();
    while(word[x-1]!='!')
        j=word[x-3];
        k=word[x-2];
        l=word[x-1];

        if(k=='o' && l=='r' && x>4){
            word[x-1]='u';
            word[x]='r';
            word[x+1]='\0';
        }
    cout<<word<<endl;

return 0;
}
In line 13 do you mean x = strlen(word)? (#include <cstring>)
Is it a correct loop in line 14?
Last edited on
Topic archived. No new replies allowed.