-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstring.cpp
43 lines (37 loc) · 992 Bytes
/
string.cpp
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
41
42
43
#include<iostream>
#include<cstring>
using namespace std;
display(char *fN,char *lN,int result)
{
if(result<0)
{
cout<<fN<<" and grather then "<<lN;
}else if(result>0)
{cout<<fN<<" and "<<" less then "<<lN;
}
}
int main()
{
char fN[10],lN[10];
int result;
cin>>fN>>lN;
/* cout<<fN<<" "<<lN<<endl;
cout<<"len:"<<strlen(fN)<<endl;
strcpy(lN,fN);
cout<<"strcpy:"<<lN<<endl;
strcat(fN, lN);
cout<<"strcat: "<<fN<<endl;
cout<<"strrev: "<<strrev(fN)<<endl;}
// cout<<"strrev:"<<fN;*/
// strcpy(fN,"Anand");
// // display(fN,lN,result);
// strcpy(lN,"Rajes");
// cout<<"strcmp local:"<<strcmp("banyy","anand")<<endl;
//display(lN,lN,result);
if(strcmp(fN,lN)>0)
cout<<fN<<" is less then "<<lN<<endl;
else if(strcmp(lN,fN)>0)
cout<<lN<<" is grather then "<<fN<<endl;
else
cout<<fN<<" is equal to "<<lN<<endl;
}