Maulin Desai
GNU/GPL :) :) :) */
#include
#include
void main()
{
char s[80],w[80],w1[80];
int i,start,cnt=0,j,k,k1,flag=1,t=0,m,temp,j1,l;
printf("\nEnter string:-\t");
gets(s);
printf("\nEnter Word:-\t");
gets(w);
printf("\nEnter replace word:-\t");
gets(w1);
for(l=0;s[l]!='\0';l++);
for(k=0;w[k]!='\0';k++);
for(k1=0;w1[k1]!='\0';k1++);
for(i=0;s[i]!='\0';i++)
{
if(s[i]!=' ' && s[i+1]!='\0')
{
cnt++;
}
else
{
if(s[i+1]=='\0')
{
cnt++;
i++;
}
temp=cnt;
start=i-cnt;//get the starting pos of particular word
cnt=0;
if(temp!=k)
{
flag=0;
continue;
}
for(j=start;j<=i-1;j++)
{
for(t=0;t
if(s[j]!=w[t])
{
flag=0;
break;
}
else
{
flag=1;
j++;
}
}
if(flag==1)
{
if(k1!=k)
{
for(t=k;t
for(m=l;m>=i;m--)
{
s[m+1]=s[m];
}
l++;
}
// printf("\nhello:\t%d",strlen(s));
// puts(s);
t=0;
for(j1=start;j1<=i;j1++)
{
for(;t
s[j1]=w1[t];
j1++;
}
if(j1 {
s[j1]=' ';
t=k1;
}
}
}
else
{
for(j=start;j
for(t=0;t
s[j]=w1[t];
j++;
}
}
}
}
if(flag==1)
break;
}
}
}
printf("\n\n\n\n\t\t\t\tReplace String is Shown Below\n\n\n\n\n\t\t\t\t");
puts(s);
}
hey raj some html tag error how to upload file instead of it man i don't have experice to doing blogging
ReplyDeleteafter the comment //printf code
ReplyDeletet=0;
for(j1=start;j1<=i;j1++)
{
for(;t<k1;t++)
{
s[j1]=w1[t];
j1++;
}
if(j1<i+1)
{
s[j1]=' ';
t=k1;
}
}
}
else
{
for(j=start;j<i-1;j++)
{
for(t=0;t<k;t++)
{
s[j]=w1[t];
j++;
}
}
}
}
if(flag==1)
break;
}
}
}
printf("\n\n\n\n\t\t\t\tReplace String is Shown Below\n\n\n\n\n\t\t\t\t");
puts(s);
}
just send me complete code file...by mail ill upload it on server n ill provide link over here..
ReplyDeleteemail me at sahinraj87@gmail.com