# include<iostream.h>
# include<conio.h>
void main()
{
int no=0,pos=0;
void delchar(char[],int,int);
char string[10];
cout<<"Enter string";
cin>>string;
cout<<"Enter no. of characters to delete";
cin>>no;
cout<<"Enter starting position";
cin>>pos;
pos = pos - 1;
delchar(string,no,pos);
getch();
}
void delchar(char s[], int n, int p)
{
int i, c;
for(i=p,c=0;c<n;i++)
{
s[i]=' ' ; c++;
}
while (s[i]!='\0')
{
s[p] = s[i];
p++; i++;
}
s[p]='\0';
cout<<"\nNow string is :" << s;
}
# include<conio.h>
void main()
{
int no=0,pos=0;
void delchar(char[],int,int);
char string[10];
cout<<"Enter string";
cin>>string;
cout<<"Enter no. of characters to delete";
cin>>no;
cout<<"Enter starting position";
cin>>pos;
pos = pos - 1;
delchar(string,no,pos);
getch();
}
void delchar(char s[], int n, int p)
{
int i, c;
for(i=p,c=0;c<n;i++)
{
s[i]=' ' ; c++;
}
while (s[i]!='\0')
{
s[p] = s[i];
p++; i++;
}
s[p]='\0';
cout<<"\nNow string is :" << s;
}
0 comments:
Post a Comment