Wednesday, June 22, 2022

COPY AND FINDING STRING

 #include<iostream>

#include<cstring>


using namespace std;


int main()

{

    string s="welcome to my world";

    char str[10];

    s.copy(str,s.length());

    cout<<str<<endl;

    cout<<s.find("to")<<endl;

    cout<<s.find("is")<<endl;

    cout<<s.rfind("o")<<endl;

    cout<<s.find_first_of('o');

    cout<<s.find_last_of('o');

    return 0;

}

No comments:

Post a Comment

CONSTRUCTURE IN PARENT CLASS

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