38.(c++)---->>> string (stl) in c++

 #include<bits/stdc++.h>

using namespace std;

int main()

{

    string s,t;

    cin>>s>>t;

    s.append(t); // it just add t with s;

//   cout<<s<<endl;

//   s.replace(8,1,"j");

//   cout<<s<<endl;

//   s.erase(7,1); 

//   cout<<s<<endl;

//   cout<s.substr(2,4-2)<<endl;

   

//   reverse(s.begin(),s.end());// just start the string end position

//   sort(s.begin(),s.end());// sort string alphabetically from A--Z order

//   out<<"no"<<endl;

    // for finding any substring .

//     int pos = s.find("jan");

//     if(pos !=string::npos)

//     {

//         cout<<s.substr(pos, 3)<<endl;  // if found that substring then we can easily print that.

//     }

//     else

//     {

//         cout<

//     }

      string s1 ="simi";

      string s2 ="sime";

      

      auto cmp =s1 ==s2; // when we are not sure about return type then we use auto

      cout<<cmp<<endl; // if true-->>1 else 0;

   cout<<s;

 return 0;        

}

Comments