#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "myhead.h"
int main(int argc, const char *argv[])
{
char str[]="12345";
char buf[]="qwer";
int i=0;
while(buf[i]!=0)
{
str[i]=buf[i];
i++;
}
str[i]=buf[i];
printf("str=%s\n",str);
strcpy///
int j=0;
int sum=0;
while(str[j]!=0)
{
sum++;
j++;
}
printf("str的长度为%d\n",sum);
///strlen///
return 0;
}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "myhead.h"
int main(int argc, const char *argv[])
{
char str[20]="12345";
char buf[20]="qwer";
int i=0;
while(buf[i]==str[i])
{
if(str[i]=0)
{
break;
}
i++;
}
if(str[i]-buf[i]>0)
{
printf("%s大于%s\n",str,buf);
}
else if(str[i]-buf[i]<0)
{
printf("%s小于%s\n",str,buf);
}
else
printf("%s等于%s\n",str ,buf);
strcmy///
int j=0;
int x=0;
while(str[j])
{
j++;
}
while(buf[x])
{
str[j]=buf[x];
j++;
x++;
}
str[j]=buf[x];
printf("str=%s\n",str);
///strcat///
return 0;
}
作业
最新推荐文章于 2024-07-10 21:37:49 发布