Advertisement
vaibhav1906

String

Nov 17th, 2021
1,460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4. int main(){
  5.    
  6.     string s1; //Always define like ""
  7.     char c = 'a'; // Always in single ''
  8.    
  9.    
  10.     cout<<"Please enter some text : "<<endl;
  11.     getline(cin, s1);
  12.    
  13.     cout<<"output is : "<<s1<<endl;
  14.    
  15.     cout<<"second letter of string s1 is : "<<s1[1]<<endl;
  16.    
  17.     cout<<"lenght of the given string is : "<<s1.length()<<endl;
  18.    
  19.     reverse(s1.begin(), s1.end());
  20.    
  21.     cout<<"Revesred string is : "<<s1<<endl;
  22.    
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement