#define _crt_secure_no_warnings #include <stdio.h> #include <stdlib.h> #include <STRING.H&G
T A string that conforms to the following characteristics ("ABCD11111ABCD2222ABCDQQQQQ") requires writing a function (interface), outputting the following result//("ABCD"), and spreading the result;//More Highlights: http://
www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg///Replace the string with (DCBA11111DCBA 2222DCBAQQQQQ) and spread the result. The number of occurrences//converted array is output//int getrestbuf (const char*buf1, int buflen, int *coun
T, Char *buf2);
int getrestbuf (const char*buf1, int buflen, int *count, char *buf2) {int i=0;
int zcount = 0;
char *p1 = BUF1;
Char *psub = "ABCD";
Char buf[] = "DCBA";
This returns the number of occurrences//while (p1 = strstr (buf1//here should be the one you've picked up) Psub NULL) while (!= (P1=STRSTR))
{zcount++; Each time you find it, replace the string with "DCBA" or let the string correspond to the position you selected here is the assignment for (i = 0; I < sTrlen (psub);
i++) {* (p1 + i) = Buf[i];
} p1 = p1 + strlen (psub);
if (*p1 = = ' ") {break;
}//printf ("%d", p1);
} strcpy (Buf2, BUF1);
*count = Zcount;
return 0;
} void Main () {int count = 0;
Char buf1[] = "ABCD11111ABCD2222ABCDQQQQQ";
int buflen = strlen (BUF1);
Char buf2[100];
Getrestbuf (BUF1, Buflen, &count, BUF2);
printf ("Find the number of strings is%d\n", count);
printf ("The original string is:%s\n", BUF1);
printf ("The replaced string is");
printf ("%s\n", buf2);
System ("pause"); }