+ 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

5th Nov 2018, 11:25 AM
mo🐼
mo🐼 - avatar
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.
5th Nov 2018, 11:52 AM
Leif
Leif - avatar
+ 1
Leif You right. I tested if more words and all words changed correctly.
5th Nov 2018, 11:57 AM
Anya
Anya - avatar
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
5th Nov 2018, 12:56 PM
mo🐼
mo🐼 - avatar
0
@Taw Forget about my posts about strings. it was wrong. That is why i deleted.
5th Nov 2018, 1:12 PM
Anya
Anya - avatar