摘要:
#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+ 阅读全文
摘要:
//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;} 阅读全文
摘要:
//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;} 阅读全文
摘要:
#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;} 阅读全文
摘要:
#include <windodws.h>system("cls"); 阅读全文