#include<iostream>
using namespace std;
int main(void)
{
char * p="abc";
char a[]="bdc";
cout<<strcmp(p,a)<<endl;
return 0;
}
#include<stdio.h>
#include<string.h>
int main(void)
{
char a[64] ;
char p[64] = "hello";
char * q = "world!";
char w[]="he llo world!";
char * ret =strcpy(a,p);
char * ret1 =strcat(p,q);
char * ret2 = strstr(p,q);
char * buf = strtok(w," ");
printf("%s\n%s\n%s\n%s\n",ret,ret1,ret2,buf);
return 0;
}
#include<iostream>
#include <string>
using namespace std;
int main(void)
{
int i = 0,sum=1;
char ch[64];
gets(ch)
cout<<ch<<endl;
while (1)
{
if(ch[i]==NULL)
break;
if (ch[i]==' ')
{
sum++;
}
i++;
}
cout<<"The number of words is:"<<sum<<endl;
return 0;
}
#include<iostream>
#include <string>
using namespace std;
int main(void)
{
char max[20];
char ch[3][20];
int i;
for (i=0;i<=2;i++)
{
gets(ch[i]);
}
strcpy(max,ch[0]);
if (strcmp(ch[0],ch[1])<0)
strcpy(max,ch[1]);
if(strcmp(max,ch[2])<0)
strcpy(max,ch[2]);
cout<<max<<endl;
return 0;
}