
C学习
文章平均质量分 64
Litbai_zhang
你怎么看你自己,那你就是怎样的你。
展开
-
C Primer Plus 第6版 第9章编程题-10题
1.设计一个函数min(x, y),返回两个double类型值的较小值。在一个简单的驱动程序中测试该函数。#include <stdio.h>double min(double,double);int main(void ){ double a,b; scanf("%lf %lf",&a,&b); printf("%g",min(a,b)); return 0;}double min(double x,double y)...原创 2021-08-13 15:00:07 · 413 阅读 · 0 评论 -
C Primer Plus 第6版 第8章编程题-8题全
tips: EOF需要先回车再ctrl+D,我的环境是windows+clion1.设计一个程序,统计在读到文件结尾之前读取的字符数。#include <stdio.h>int main(void ){ int count = 0; while ((getchar())!= EOF){ count++; } printf("The number of charactors is %d", count); return 0...原创 2021-08-11 14:24:54 · 254 阅读 · 0 评论 -
2021 Clion中文输出解决方式-有效
第一步,改为UTF8设置搜索File Encoding第二步快捷键Ctrl+Shift+Alt+/,选择Registry第三步去掉value的勾选搞定!原创 2021-07-30 14:25:38 · 2389 阅读 · 2 评论 -
C Primer Plus 第6版 第7章编程题-11题全
1.编写一个程序读取输入,读到#字符停止,然后报告读取的空格数、换行符数和所有其他字符的数量。#include <stdio.h>#include <ctype.h>int main(void ){ char ch = 0 ; int spaces = 0; int lines = 0; int charactors = 0; while((ch = getchar()) != '#'){ if(ch == ' '...原创 2021-07-29 16:37:30 · 1260 阅读 · 0 评论 -
C Primer Plus 第6版 第六章编程题答案-18题全
1.编写一个程序,创建一个包含26个元素的数组,并在其中储存26个小写字母。然后打印数组的所有内容。```#include <stdio.h>int main(void ){ char a[26]; for (int i=0;i<26;i++){ a[i] = 'a'+i; printf("%c",a[i]); } printf("\n"); return 0;}```2.使用嵌套循环,按下面的.原创 2021-07-20 23:03:29 · 515 阅读 · 0 评论