b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

strchr函数php_c++ strchr函数_模拟实现strchr函数(9)

电脑杂谈  发布时间:2017-02-21 09:19:16  来源:网络整理

{ char *buf1 = "aaabbb", *buf2 = "bbbccc", *buf3 = "ccc";int ptr;ptr = strncmp(buf2,buf1,3);if (ptr > 0)

printf("buffer 2 is greater than buffer 1n");else printf("buffer 2 is less than buffer 1n");ptr = strncmp(buf2,buf3,3);if (ptr > 0)

printf("buffer 2 is greater than buffer 3n");else printf("buffer 2 is less than buffer 3n");return(0);}

函数名: strncmpi功 能: 把串中的一部分与另一串中的一部分比较, 不管大小写用 法: int strncmpi(char *str1, char *str2);程序例:#include <string.h> #include <stdio.h> int main(void)

{ char *buf1 = "BBBccc", *buf2 = "bbbccc";int ptr;ptr = strncmpi(buf2,buf1,3);if (ptr > 0)

printf("buffer 2 is greater than buffer 1n");if (ptr < 0)

printf("buffer 2 is less than buffer 1n");if (ptr == 0)

printf("buffer 2 equals buffer 1n");return 0;}

函数名: strncpy功 能: 串拷贝用 法: char *strncpy(char *destin, char *source, int maxlen);程序例:#include <stdio.h> #include <string.h> int main(void)

{ char string[10];char *str1 = "abcdefghi";strncpy(string, str1, 3);string[3] = '';printf("%sn", string);return 0;}

函数名: strnicmp功 能: 不注重大小写地比较两个串用 法: int strnicmp(char *str1, char *str2, unsigned maxlen);程序例:#include <string.h> #include <stdio.h> int main(void)

{ char *buf1 = "BBBccc", *buf2 = "bbbccc";int ptr;ptr = strnicmp(buf2, buf1, 3);if (ptr > 0)

printf("buffer 2 is greater than buffer 1n");if (ptr < 0)

printf("buffer 2 is less than buffer 1n");if (ptr == 0)

printf("buffer 2 equals buffer 1n");return 0;}

函数名: strnset功 能: 将一个串中的所有字符都设为指定字符用 法: char *strnset(char *str, char ch, unsigned n);程序例:#include <stdio.h> #include <string.h> int main(void)


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-33642-9.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 谷新玲
      谷新玲

      我没觉得台湾香港人享受更高品质生活

    • 辽圣宗耶律隆绪
      辽圣宗耶律隆绪

      敢于鼓足勇气对美国说关你鸟事

    热点图片
    拼命载入中...