摘要: #include <stdio.h>int main(){ /*判断一个字符串中子串出现的次数.*/ char str1[100],str2[20],*p,*q; int sum=0; printf("please input two strings.\n"); scanf("%s%s",str1,str2); p=str1;q=str2; while(*p!='\0') { if(*p==*q) { while(*p==*q&&*q!='\0') { p++; q++; } } else p+ 阅读全文
posted @ 2013-03-06 22:15 王井玉 阅读(516) 评论(0) 推荐(0) 编辑
摘要: //fputc.c#include <stdio.h>int main(){ /*int fputc(int ch,FILE *p);送一个字符到一个流中*/char *p="abcdefgh";while(*p!='\0'){fputc(*p,stdout);p++;}printf("\n");return 0;} 阅读全文
posted @ 2013-03-06 21:08 王井玉 阅读(453) 评论(0) 推荐(0) 编辑
摘要: //strcpy.c#include <stdio.h>#include <windows.h>int main(){/*exterm strcpy(char *dest,char *src);将src字符串中的内容复制到dest所指的字符中.返回指向dest字符串的指针.*/char *d="abcdefgh";char p[20]="";system("cls");strcpy(p,d);printf("%s\n",p);return 0;} 阅读全文
posted @ 2013-03-06 20:35 王井玉 阅读(431) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <windows.h>int main(){/*strncat的用法extern char *strncat(char *dest,char *src,int n);将src所指字符串的n个字符填加到dest所指的字符串尾部*/char d[20]="abcd";char *p="efgh";system("cls");strncat(d,p,4);printf("%s\n",d);return 0;} 阅读全文
posted @ 2013-03-06 19:57 王井玉 阅读(699) 评论(0) 推荐(0) 编辑
摘要: #include <windodws.h>system("cls"); 阅读全文
posted @ 2013-03-06 17:43 王井玉 阅读(382) 评论(0) 推荐(0) 编辑