自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(74)
  • 收藏
  • 关注

转载 8.12.5

# 8.12.5#include <stdio.h>int main(void){ int rangebig, rangesmall, input; int defaultnum = 67;// scanf("%d", &input); while(scanf("%d", &input)) { ...

2019-05-25 21:24:00 91

转载 8.11.4.c

如果有超过2个连续的非字母出现则单词计数不准确。# 8.11.4.c#include <stdio.h>#include <ctype.h>int main(void){ int word = 0, ch_total = 0, nocharflag = 0; char ch; while ((ch = getchar(...

2019-05-20 23:47:00 97

转载 8.11.3 统计大小写字符个数

# 8.11.3.c#include <stdio.h>#include <ctype.h>int main(void){ char ch; int upper = 0, lower = 0, total = 0; while ((ch = getchar()) != EOF) { ++total; ...

2019-05-20 20:35:00 136

转载 8.10.8 使用getchar函数之前记得处理换行符

# 8.10.8#include <stdio.h>int main(void){ printf("使用getchar函数之前记得处理换行符"); putchar('\n'); printf("在使用缓冲输入的系统中,"); printf("把数值和字符混合输入会遇到"); printf("什么潜在问题?"); put...

2019-05-14 21:45:00 216

转载 8_8 menuette.c

8_8 menuette.c -- 菜单程序#include <stdio.h>char get_choice(void);char get_first(void);int get_int(void);void count(void);int main(void){ int choice; void count(void); while...

2019-05-13 00:18:00 98

转载 8.7 checking.c

// checking.c -- 输入验证#include <stdio.h>#include <stdbool.h>// 验证输入是一个整数long get_long(void);// 验证范围的上下限是否有效bool bad_limits(long begin, long end, long low, long hi...

2019-05-13 00:17:00 151

转载 7.12.11 蔬菜计算器

# 7.12.11#include <stdio.h>#define artichoke 2.05#define beet 1.15#define carrot 1.09#define discount 0.95int main(void){ double partichoke, sum_artichoke_pound = 0; ...

2019-05-09 17:45:00 201

转载 断网,启用网络,关机的实现。

windows 下实现 shutdown_two.c 此为第三版 // 我需要一个断开网络,启用网络,定时发送邮件后关机的功能,其中定时发送邮件功能是邮件客户端完成;原来的工具是用bat实现的,后来给BAT内容放到C中,延时部分用的还是 choice ,因此需要手工输入延时时间。 // 后来想做个自动计算时间的方法,后来发现sleep用这个功能,遂写了这个功能。说个小...

2019-05-09 14:59:00 239

转载 8.4 一个拖沓且错误的猜数字程序

8.4 guess.c -- 一个拖沓且错误的猜数字程序#include <stdio.h>int main(void){ int guess = 1; printf("Pick an integer from 1 to 100. I will try to guess "); printf("it. \nRespond with a y if ...

2019-05-07 23:23:00 159

转载 8.3 打开一个文件并显示该文件

8.3 file_eof.c -- 打开一个文件并显示该文件#include <stdio.h>#include <stdlib.h> // 为了使用exit()int main(){ int ch; FILE *fp; char fname[50]; // 存储文件名 printf...

2019-05-07 23:22:00 125

转载 8.2 重复输入,直到文件结尾

echo_eof.c -- 重复输入,直到文件结尾#include <stdio.h>int main(void){ int ch; while ((ch = getchar()) != EOF) // Ctrl + Z 结束符 putchar(ch); return 0;}转载于:https://w...

2019-05-07 23:21:00 421

转载 8.1 重复 输入

8.1 echo.c -- 重复 输入#include <stdio.h>int main(void){ char ch; while ((ch = getchar()) != '#') putchar(ch); return 0;}转载于:https://www.cnblogs.com/EisNULL/p/10828...

2019-05-07 23:21:00 77

转载 7.12.10 计算税金

# 7.12.10#include <stdio.h>#define big_rate 0.28#define sml_rate 0.15#define single 17850#define god 23900#define mar_two 29750#define mar_one 14875int main(void){ float earni...

2019-05-06 14:19:00 144

转载 7.12.9 显示所有小于或等于该数的素数。

#7.12.9#include <stdio.h>int main(void){ int num; int i , j; int flag = 0; printf("请输入一个正整数:\n"); if ((scanf("%d", &num) == 1) && (num > 0)) { ...

2019-05-04 23:00:00 185

转载 7.12.8

# 7.12.8#include <stdio.h>#define over_time 1.5 * 10#define three_hundred_rate 0.15#define one_hundred_half_rate 0.2#define more_then_four_hun_half_rate 0.25#define three_hundr...

2019-04-28 22:59:00 77

转载 7.12.8

# 7.12.8#include <stdio.h>#define over_time 1.5 * 10#define three_hundred_rate 0.15#define one_hundred_half_rate 0.2#define more_then_four_hun_half_rate 0.25#define three_hundre...

2019-04-25 22:27:00 99

转载 7.12.7

# 7.12.7#include <stdio.h>#define basic_wage 10.00#define over_time 1.5 * 10#define three_hundred_rate 0.15#define one_hundred_half_rate 0.2#define more_then_four_hun_half_rate ...

2019-04-24 21:25:00 109

转载 7.12.6

# 7.12.6#include <stdio.h>int main(void){ char ch; char prechar; int frequency = 0; while ((ch = getchar()) != '#') { if (ch == 'e') prechar = '...

2019-04-24 16:12:00 62

转载 7.12.5

# 7.12.4#include <stdio.h>int main(void){ int Exclamationtoperiod = 0; int two2one = 0; char ch; while ((ch = getchar()) != '#') { switch (ch) { ...

2019-04-24 15:32:00 78

转载 7.12.4

# 7.12.4#include <stdio.h>int main(void){ int Exclamationtoperiod = 0; // 感叹号替换句号次数 int two2one = 0; // 两个感叹号替换一个感叹号次数 char ch; while ((ch = getchar()) !=...

2019-04-24 15:17:00 93

转载 7.12.3

# 7.12.3#include <stdio.h>int main(void){ int odd_number = 0; int even_number = 0; int odd_sum = 0; int even_sum = 0; int num; while ( scanf("%d", &num) == ...

2019-04-24 14:50:00 52

转载 7.12.2

# 7.12.2#include <stdio.h>int main(void){ char ch; int count = 0; while ((ch = getchar()) != '#') { printf("%c-%d ", ch, ch); if ((++count % 8) == 0) ...

2019-04-23 00:16:00 69

转载 7.12.1

# 7.12.1#include <stdio.h>int main(void){ char ch; int space_count = 0; int linebreak_count = 0; int other_count = 0; while ((ch = getchar()) != '#') { ...

2019-04-22 23:29:00 56

转载 7.11.8

7.11.8/* retire.c */#include <stdio.h>int main(void){ int age = 60; while (++age <= 65) { if ((age % 20) == 0) /*age是否能被20整除? */ printf("You are %d. H...

2019-04-21 21:19:00 99

转载 循环测试条件前缀和后缀的区别

左后缀中,当age=64执行完循环体时,到达测试条件age++<=65时,先拿为64的age与65比较,同时age本身加1,因64小于65成立,所以进入循环体中执行,进入循环体执行的age值是65,执行完本次循环后,跳到测试条件是65的age<=65成立,同时age+1,所以进入循环体的age是66,会打印age is66这行,执行完本次循环体后,再次跳到age++&...

2019-04-21 20:58:00 415

转载 7.11.7 两个版本

# 7.11.7 #include <stdio.h>int main(void){ char ch; int lc = 0; // 统计小写字母 int uc = 0; // 统计大写字母 int oc = 0; // 统计其他字母 while ((ch = getchar()) != '#') { ...

2019-04-21 20:34:00 78

转载 7.11.5

7.11.5#include <stdio.h>int main(void){ int num; for (num = 1; num <= 11; num++) { if (num % 3 == 0) putchar('$'); else putchar('*'...

2019-04-16 23:16:00 62

转载 7.12 vowels.c 程序

7.12 vowels.c 程序#vowels.c -- 使用多重标签#include <stdio.h>int main(void){ char ch; int a_ct, e_ct, i_ct, o_ct, u_ct; a_ct = e_ct = i_ct = o_ct = u_ct = 0; printf("Enter some ...

2019-04-13 21:30:00 141

转载 7.11 animals.c 程序

7.11 animals.c 程序#include <stdio.h>#include <ctype.h>int main(void){ char ch; printf("Give me a letter of the alphabet, and I will give "); printf("an animal name\nbeg...

2019-04-13 21:06:00 365

转载 7.6.2 break 语句

7.6.2 break 语句 程序执行到循环中的break语句时,会种植包含它的循环,并继续执行下一阶段。如果break语句位于嵌套循环内,它只会影响包含它的当前循环。 break还可用于因其他原因退出循环的情况。 在for循环中的break和continue的情况不同,执行完break语句后会直接执行循环后面的第1条语句,连更新部分也跳过。嵌套循环内层的br...

2019-04-13 20:52:00 55

转载 7.10 break.c 程序

7.10 break.c 程序#include <stdio.h>int main(void){ float length, width; printf("Enter the length of the rectangle:\n"); while (scanf("%f", &length) == 1) { prin...

2019-04-13 20:35:00 115

转载 7.6.1 continue 语句

7.6.1 continue 语句 3种循环都可以使用CONTINUE语句。执行到该语句时,会跳过本次迭代的剩余部分,并开始下一轮迭代。如果continue语句在嵌套循环内,则只会影响包含该语句的内层循环。 以上介绍了continue语句让程序跳过循环体的余下部分。那么从何处开始继续循环?对于while和do while循环,执行continue语句后的下一个行为是对循环...

2019-04-13 14:51:00 107

转载 test

转载于:https://www.cnblogs.com/EisNULL/p/10700956.html

2019-04-13 14:07:00 67

转载 7.9 skippart.c 程序

7.9 skippart.c 程序#include <stdio.h>int main(void){ const float MIN = 0.0f; const float MAX = 100.0f; float score; float total = 0.0f; int n = 0; float min = MAX;...

2019-04-13 14:06:00 163

转载 7.8 paint.c 程序

## 7.8 paint.c 程序#include <stdio.h>#define COVERAGE 350 // 每罐尤其可刷的面积(单位:平方英尺)int main(void){ int sq_feet; int cans; printf("Enter number of square feet to be painted...

2019-04-13 12:42:00 123

转载 7.5 条件运算符: ?:

7.5 条件运算符: ?:C提供条件表达式(conditional expression)作为表达if else语句的一种便捷方式,该表达式使用?: 条件运算符。该运算符分为两部分,需要3个运算对象。条件运算符是C语言中的唯一的三元运算符。条件表达式的通用形式如下:expression1 ? expression2 : expression3如果expression1为真(非...

2019-04-13 12:34:00 108

转载 7.7 wordcnt.c 程序

wordcnt.c 程序#include <stdio.h>#include <ctype.h> // 为isspace() 函数提供原型#include <stdbool.h> // 为bool、true、false提供定义#define STOP '|'int main(void){ char c; ...

2019-04-13 12:31:00 251

转载 7.3

逻辑运算符的优先级比关系运算符优先级低,所以不必在子表达式两侧加圆括号。iso646.h头文件因此,C99标准新增了可代替逻辑运算符的拼写,它们被定义在iso646.h头文件中。如果在程序中包含该头文件,便可用and代替&&、or代替||、not代替!。例如,可以把下面的代码:if ( ch != '"' && ch != '\'') c...

2019-04-10 22:30:00 102

转载 7.6 chcount.c -- 使用逻辑与运算符

include <stdio.h>#define PERIOD '.'int main(void){ char ch; int charcount = 0; while ((ch = getchar()) != PERIOD) { if (ch != '"' && ch != '\'') ...

2019-04-10 21:55:00 137

转载 7.5

// 7.5/* divisors.c -- 使用嵌套if语句显示一个数的约数 /#include <stdio.h>#include <stdbool.h>int main(void){unsigned long num; // 待测试的数unsigned long div; // 可能的约数bool isPrime; // 素数标记print...

2019-04-08 00:08:00 76

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除