#ifndef Str_H
#define Str_H
int strlen(char *s);
char *strcat(char *s1, char *s2);
int strcmp(char* s1, char *s2);
#endif
#include "str.h"
int strlen(char *s)
{
char *p = s;
int len = 0;
while (*p != '\0')
{
len++;
p++;
}
return len;
}
char* strcat(char *s1, char *s2)
{
char *p = s1, *q = s2;
while (*p != '\0')
{
}
}
#include <iostream>
#include "str.h"
using namespace std;
int main()
{
char ch[20] = "I love",*str = "China!";
cout << strlen(ch) << endl;
cout << strlen(str) << endl;
cout << strcmp(ch,str) << endl;
cout << strcmp(str,ch) << endl;
strcat(ch,str);
for(int i = 0;ch[i]!='\0';i++)
{
cout << ch[i];
}
cout << endl;
return 0;
}