8.12.5
摘要:8.12.5 include int main(void) { int rangebig, rangesmall, input; int defaultnum = 67; // scanf("%d", &input); while(scanf("%d", &input)) { if (input d
阅读全文
posted @
2019-05-25 21:24
viviLy
阅读(111)
推荐(0)
8.11.4.c
摘要:如果有超过2个连续的非字母出现则单词计数不准确。 8.11.4.c include include int main(void) { int word = 0, ch_total = 0, nocharflag = 0; char ch; while ((ch = getchar()) != EOF
阅读全文
posted @
2019-05-20 23:47
viviLy
阅读(181)
推荐(0)
8.11.3 统计大小写字符个数
摘要:8.11.3.c include include int main(void) { char ch; int upper = 0, lower = 0, total = 0; while ((ch = getchar()) != EOF) { ++total; if (islower(ch) 0)
阅读全文
posted @
2019-05-20 20:35
viviLy
阅读(179)
推荐(0)
8.10.8 使用getchar函数之前记得处理换行符
摘要:8.10.8 include int main(void) { printf("使用getchar函数之前记得处理换行符"); putchar('\n'); printf("在使用缓冲输入的系统中,"); printf("把数值和字符混合输入会遇到"); printf("什么潜在问题?"); put
阅读全文
posted @
2019-05-14 21:45
viviLy
阅读(388)
推荐(0)
7.12.11 蔬菜计算器
摘要:7.12.11 include define artichoke 2.05 define beet 1.15 define carrot 1.09 define discount 0.95 int main(void) { double partichoke, sum_artichoke_pound
阅读全文
posted @
2019-05-09 17:45
viviLy
阅读(302)
推荐(0)
7.12.10 计算税金
摘要:7.12.10 include define big_rate 0.28 define sml_rate 0.15 define single 17850 define god 23900 define mar_two 29750 define mar_one 14875 int main(void
阅读全文
posted @
2019-05-06 14:19
viviLy
阅读(119)
推荐(0)
7.12.9 显示所有小于或等于该数的素数。
摘要:7.12.9 include int main(void) { int num; int i , j; int flag = 0; printf("请输入一个正整数:\n"); if ((scanf("%d", &num) == 1) && (num 0)) { for (j = 3; j
阅读全文
posted @
2019-05-04 23:00
viviLy
阅读(149)
推荐(0)
7.12.8
摘要:7.12.8 include 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
阅读全文
posted @
2019-04-28 22:59
viviLy
阅读(104)
推荐(0)
7.12.8
摘要:7.12.8 include 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
阅读全文
posted @
2019-04-25 22:27
viviLy
阅读(126)
推荐(0)
7.12.7
摘要:7.12.7 include 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_h
阅读全文
posted @
2019-04-24 21:25
viviLy
阅读(104)
推荐(0)
7.12.6
摘要:7.12.6 include int main(void) { char ch; char prechar; int frequency = 0; while ((ch = getchar()) != ' ') { if (ch == 'e') prechar = 'e'; if ((ch == '
阅读全文
posted @
2019-04-24 16:12
viviLy
阅读(86)
推荐(0)
7.12.5
摘要:7.12.4 include int main(void) { int Exclamationtoperiod = 0; int two2one = 0; char ch; while ((ch = getchar()) != ' ') { switch (ch) { case '.': putch
阅读全文
posted @
2019-04-24 15:32
viviLy
阅读(106)
推荐(0)
7.12.4
摘要:7.12.4 include int main(void) { int Exclamationtoperiod = 0; // 感叹号替换句号次数 int two2one = 0; // 两个感叹号替换一个感叹号次数 char ch; while ((ch = getchar()) != ' ')
阅读全文
posted @
2019-04-24 15:17
viviLy
阅读(104)
推荐(0)
7.12.3
摘要:7.12.3 include 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) == 1) {
阅读全文
posted @
2019-04-24 14:50
viviLy
阅读(118)
推荐(0)
7.12.2
摘要:7.12.2 include int main(void) { char ch; int count = 0; while ((ch = getchar()) != ' ') { printf("%c %d ", ch, ch); if ((++count % 8) == 0) printf("\n
阅读全文
posted @
2019-04-23 00:16
viviLy
阅读(110)
推荐(0)
7.12.1
摘要:7.12.1 include int main(void) { char ch; int space_count = 0; int linebreak_count = 0; int other_count = 0; while ((ch = getchar()) != ' ') { if (ch =
阅读全文
posted @
2019-04-22 23:29
viviLy
阅读(121)
推荐(0)
7.11.8
摘要:7.11.8 / retire.c / include int main(void) { int age = 60; while (++age
阅读全文
posted @
2019-04-21 21:19
viviLy
阅读(104)
推荐(0)
7.11.7 两个版本
摘要:7.11.7 include int main(void) { char ch; int lc = 0; // 统计小写字母 int uc = 0; // 统计大写字母 int oc = 0; // 统计其他字母 while ((ch = getchar()) != ' ') { if (( ch
阅读全文
posted @
2019-04-21 20:34
viviLy
阅读(121)
推荐(0)
7.11.5
摘要:7.11.5 include int main(void) { int num; for (num = 1; num
阅读全文
posted @
2019-04-16 23:16
viviLy
阅读(107)
推荐(0)
7.2 if else 语句
摘要:7.2 if else 语句 if else语句的通用形式是: if ( expression ) statement1 else statement2 如果expression为真(非0),则执行statement;如果expression为假或0,则执行else后面的statement2. st
阅读全文
posted @
2019-03-30 17:45
viviLy
阅读(336)
推荐(0)