Wednesday, June 22, 2022

REPLACE AND SWAPING THE STRING

 #include<iostream>

using namespace std;



int main()

{

    string str1="hello";

    string str2="world";

    cout<<str1.capacity()<<endl;

    cout<<str1.append(" welcome to us");

    cout<<str1.insert(0,"::");

    cout<<str1.replace(9,20,"::");

    str1.swap(str2);

    str1.push_back('y');

    cout<<str1<<endl;

    cout<<str1.capacity()<<endl;


    return 0;

}

No comments:

Post a Comment

CONSTRUCTURE IN PARENT CLASS

class Parent {     public Parent()     {         System.out.println("Parent Constrcutor");     }              } class Child extend...