QUE- WAP TO SHOW THE USE OF STRING FNs
insert
erase
substr
empty
size
length
getline
Answer-
#include<iostream.h>
#include<conio.h>
#include<string.h>
using std::string;
int main()
{
string f,s2;
char a[3];
int c,n,l,q,w,e;
cout << “Enter String: “;
getline(cin,f);
cout<< f <<endl;
cout<<“\nEnter no. of character you want to skip: “;
cin>>c;
s2=f.substr(c);
n=s2.empty();
if(n==0)
{
cout<<s2;
cout<<“\nSize of string after skipping chars:”<<s2.size();
cout<<“\nLength of string :”<<f.length();
cout<<“\nEnter 3 character to insert in s2:”;
cin>>a;
cout<<“\nEnter position from which you overwrite:”;
cin>>l;
cout<<“\nS2 after inserting at 2nd position:”<<s2.insert(l,a);
cout<<“\nNo. of element you want to delete:”;
cin>>q;
cout<<“\nPosition of element from where you want to delete:”;
cin>>w;
cout<<“\nAfter <erase> fn.:”<<s2.erase(w,q);
}
cout<<“\n\nPROGRAMMING @C#ODE STUDIO”;
getch();
}