编写字符串比较函数strcmp
来源:互联网 发布:阿里云大数据竞赛 编辑:程序博客网 时间:2024/05/21 16:57
#include <stdio.h>
int mystrcmp(char *pr,char *pt)
{
int k;
while(*pr==*pt&&*pr!='/0'&&*pt!='/0')
{
/* 如果两个字符相等,并且在数组内,指针下移*/
pr++;
pt++;
}
/*进行判断,并返回相应的值*/
if(*pr>*pt)
return 1;
else if(*pr<*pt)
return -1;
else
return 0;
}
main()
{
char str1[100],str2[100];
int k;
printf("Please input String1:/n");
gets(str1);
printf("Please input String2:/n");
gets(str2);
k=mystrcmp(str1,str2);
if(k==-1)
printf("%s<%s",str1,str2);
else if(k==1)
printf("%s>%s",str1,str2);
else
printf("%s==%s",str1,str2);
}
- 编写字符串比较函数strcmp
- 编写字符串比较函数strcmp .
- 字符串比较函数strcmp
- 比较字符串strcmp()函数
- strcmp字符串比较函数
- strcmp()字符串比较函数
- strcmp()字符串比较函数
- 完成字符串比较函数strcmp()
- C语言 编写程序实现字符串比较,不允许使用strcmp函数。
- 【字符串比较函数】strcmp,stricmp,strcmpi区别
- 自己动手写字符串比较函数strcmp()
- strcmp()字符串比较函数用法问题
- 实现strcmp函数功能--比较字符串
- 指针实现字符串比较函数strcmp
- strcmp和memcmp两个字符串比较函数
- 字符串比较用strcmp
- 比较字符串大小strcmp
- strcmp字符串比较
- Unix/Linux编程实践教程
- 我与csdn
- word中如何输入打勾方框
- ZZ博弈论和纳什平衡
- 学习linux.unix编程方法的建议,学习Linux的四个步骤
- 编写字符串比较函数strcmp
- cygwin的安装,vi的使用,gcc,g++的使用
- win7必看
- VS2003无法启动调试 没有正确安装调试器错误解决方案
- matlab(Simulink)中S-function函数编写规则
- All About JAVA 继承、多态、抽象类、接口、面向接口编程
- (仿真函数篇二)S-Function
- VOA慢速英语练听力需坚持
- 一种特殊的一致性哈希算法的研究