prev | Character Arrays - String manipulations: 98.delete the given pattern (16.05.2010) /* Program# 98 date : 10-01-2009 Delete the Pattern */ #include <stdio.h> main(){ char a[100],b[100],c[100]; int i,j,l,k; i=0; scanf("%c",&a[i]); while(a[i]!='$'){ i++; scanf("%c",&a[i]); } a[i]='\0'; j=0; scanf("%c",&b[j]); while(b[j]!='$'){ j++; scanf("%c",&b[j]); } b[j]='\0'; i=0;l=0; while(a[i]!='\0'){ j=0; k=i; while((b[j]==a[k]) && (b[j]!='\0')){ j++; k++; } if(b[j]=='\0'){ i=k; } c[l]=a[i]; i++; l++; } c[l]='\0'; printf("\na=%s \nb=%s \nc=%s",a,b,c); } |
next |