Skip to main content

String in C++

 



#include<bits/stdc++.h>

using namespace std;

int main()
{
    // string a = "dgfsndgdf";

    // converting to upper case

    // for (int i = 0; i < a.size();  i++)
    // {
    //     if(a[i]>= 'a' && a[i]<='z')
    //     a[i]-=32;
    // }
    // cout<<a;



    // To lower
    // for (int i = 0; i < a.size();  i++)
    // {
    //     if(a[i]>= 'A' && a[i]<='Z')
    //     a[i]32=32;
    // }
    // cout<<a;



    // Short method of converting into upper case
    // transform(a.begin(),a.end(), a.begin(),::toupper);

    // To lower
    // transform(a.begin(),a.end(), a.begin(),::tolower);
    // cout<<a;


    // Greater than or less than
    // string s = "3322724";
    // sort(s.begin(),s.end(),greater<int>());
    // sort(s.begin(),s.end(),less<int>());
    // cout<<s;


        // convert string to int
 string a = "36453234";
 reverse(a.begin(),a.end());
 stringstream geek(a); // It will convert string to int
 int b = 0;
 geek>>b;

cout<<b;
   
    return 0;
}

Comments