+ 1
Where is the problem ?
well it when I enter a word with ph it supposed to change it to g but it just keep displaying the same word is the problem in the loop or what! https://code.sololearn.com/c01iL2MGNFqu/?ref=app
4 Antworten
+ 3
Looks to me you have it backwards. If last is 'p' and the current is 'h' then you read 'ph'. Try:
if(c == 'h' && last == 'p')
If I enter phil. it returns gil. then.
Edit: and for the sake of reducing calls to the kernel, you definitely ought to read the entire string into a local buffer first using fgets.
+ 1
Leif You right. I tested if more words and all words changed correctly.
0
it did work then the problem should be in the
last =0
c !
and yes I know I can use strings but i need this one just with characters and after that with strings
0
@Taw
Forget about my posts about strings. it was wrong. That is why i deleted.