<C和指针>——6.2 题目: 编写一个函数,删除源字符串中含有的子字符串部分. 函数原型: int del_substr(char *str, char const *substr); 解答代码: #include <stdio.h> int del_substr(char *str, char const *substr) { if ((*str != NULL) && (*substr != NULL)) { for(; *str != '\0'; str++…
<C和指针>——6.3 题目: 编写一个函数,把参数字符串中的字符反向排列. 函数原型: void reverse_string(char *string); 要求: 使用指针而不是数组下标 不要使用任何C函数库中用于操纵字符串的函数 不要声明一个局部数组来临时存储参数字符串 解答代码: #include <stdio.h> void reverse_string(char *string) { ; while (*(string+n) != '\0') //计算字符串中字符的个数…
5.1 题目: 略 解答代码: #include <stdio.h> int main(void) { char ch; while (((ch = getchar()) != EOF) && (ch != 'z')) { if (ch >= 'A' && ch <= 'Z') { ch += 'a' - 'A'; } putchar(ch); } getchar(); ; } 5.2 题目: 略 解答代码: #include <stdio.h…
<C和指针>——6.6 题目: 在指定的下限.上限之间使用数组方法查找质数,并将质数提取出来. 要求: 略 解答代码: #include <stdio.h> #define UPLIMIT 11000 #define DOWNLIMIT 10000 #define NUM UPLIMIT-DOWNLIMIT void show_array(int *p, int n) //显示数组p[]中的n个元素 { int i; ; i<n; i++) { == ) &&…
<C和指针>——6.4 题目: 质数是只能被1和本身整除的整数. 在1到1000之间的质数,在数组中剔除不是质数的数. 解答代码: #include <stdio.h> #define LIMIT 1000 void show_array(int *p, int n) //显示数组p[]中的n个元素 { int i; ; i<n; i++) { == ) printf("\n"); printf("%5d ", *(p+i)); } p…
<C和指针>——6.1 6.1 题目: 编写一个函数,在一个字符串中进行搜索,查找另一子字符串中出现的字符. 函数原型如下: char *find_char(char const *source, char const *chars); 要求: a.不适用任何用于操纵字符串的库函数(如:strcpy strcmp等) b.函数中不能使用下标引用 解答代码: #include <stdio.h> char *find_char(char const *source, char con…
10.1 #include <stdio.h> typedef struct { unsigned ]; unsigned ]; unsigned ]; }TelphoneNumber; typedef struct { unsigned ]; unsigned ]; TelphoneNumber UserTelphone; TelphoneNumber CallTelphone; TelphoneNumber PayTelphone; }Telphone_Call; int main (vo…
9.1 #include <stdio.h> #include <ctype.h> #include <string.h> #define N 100 int main (void) { ; ]; //= "Hello world! \t3I'm here!"; char *input = strarray; char ch; unsigned ; , spc=, num=, low=, upp=, puc=, upr=; , spcf=, numf…
8.1 #include <stdio.h> int main (void) { int a, b, c, d; // 不使用嵌套花括号初始化 unsigned ][][][] = { , , , , , , , , , , , , , , , , , , , , // 0,0,X,X , , , , , , , , , , , , , , , , , , , , // 0,1,X,X , , , , , , , , , , , , , , , , , , , , , , , , , , ,…
DSAPI多功能组件编程应用-参考-Win32API常数 在编程过程中,常常需要使用Win32API来实现一些特定功能,而Win32API又往往需要使用一些API常数,百度搜索常数值,查手册,也就成了家常便饭,为此,本人将Win32API中数千个常数集成于DSAPI.dll中,使用时只需要输入 DSAPI.其他.常数表.DSAPI.其他.常数表. 即可选择你需要的常数.…