-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring_basic.cpp
More file actions
40 lines (37 loc) · 982 Bytes
/
string_basic.cpp
File metadata and controls
40 lines (37 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<bits/stdc++.h>
using namespace std;
int main(){
string fname , lname;
getline(cin,fname);
getline(cin,lname);
cout << fname <<endl; //printing string
//reverse string
string rev = "kumar sandeep";
reverse(rev.begin() , rev.end());
cout << rev;
/* string last = lname;
if(last == lname)
cout<<"Well equal"<<endl;
last = last + "singh";
if(last != lname)
cout<<"after modification not equal"<<endl;
//traversing string
for(int i = 0 ; i < fname.length() ; i++)
cout<<fname[i];
for(char x : fname)
cout<<x;
//compare string
string s1 = "abc";
string s2 = "bcd";
if(s1 == s2)
cout<<"equal"<<endl;
else if (s1 < s2 )
cout<<"lesser"<<endl;
else
cout<<"greater"<<endl;
substring(start , how_MANY_CHARACTER), find() , +
cout << fname + lname <<endl;
cout<<fname.substr(1,4)<<endl<<lname.find("mar");
*/
return 0;
}