String1=zamv
String2=lpwf
The programm need to replace z with l, a with p...
string1[i]=string2[i] but in String3 which u put from keyboard
Example:
String3: ovaa za
after transformation
String3: ofpp lp
I wrote this code but id doesnt work when you put sentences seperated with space ..
example:
String3: aaa zz
after transformation
String3: ppp -only this
Can anyone help me to simplify this code... ? Thanks
insertCode:#include <stdio.h> #define max 100 int main() { char niza1[]="zamv"; char niza2[]="lpwf"; char niza3[max]; int i=0; int j=0; printf("Vnesi Niza 3: \n"); scanf("%s", niza3); while( niza3[i] != '\0' ) { if (niza1[j]!='\0') { if(niza3[i]==niza1[j]) { niza3[i]=niza2[j]; } else if(niza3[i]==niza1[j+1]) { niza3[i]=niza2[j+1]; } else if(niza3[i]==niza1[j+2]) { niza3[i]=niza2[j+2]; } else if(niza3[i]==niza1[j+3]) { niza3[i]=niza2[j+3]; } else i++; } } printf("%s", niza3); }