《电大C语言程序设计第1234次作业及答案》由会员分享,可在线阅读,更多相关《电大C语言程序设计第1234次作业及答案(27页珍藏版)》请在人人文库网上搜索。

1、M資妄 呦圧-H亘a-啟甸应nnns鸯圧於 1 #inc-udecsfdiohv void main() 宀inf XGSwifch(2*xl3)宀case 4-prinff=%d=x= case 7-prinff=%d=2*x+*1)s case *1f?prinff(=%d=3*xlL)break defauprinw%=-2,|=少=匸 prinx=%s_n=swifch end:)2 #inc-udecsfdiohv void main() 宀inf -WHO-for(li-17-H6T+)s+.*rprinx=su%2n=s)3snccdeAsfdio.hvvoid main()宀i。

2、nf LS1H0W2H for(li-? void main()int n=10,y=1;while(n-)y+;y+; printf(y=%dn,y);5. #include void main()int f,f1,f2,i;f1=f2=1;printf(%d %d ,f1,f2);for(i=3;i #includevoid main()int i,n;的平方根并取整for(n=2;ntemp)printf(%d ,n);printf(n);#参考答案:7. #include #include const int M=20; void main() int i,c2,c3,c5; c2=c。

3、3=c5=0;for(i=1;i #include const int M=20; void main()int i,s; for(i=1,s=0;i5的最小n值。5编写一个主函数,求满足不等式22+42+”+n2void fun4(char* a,int b)doif(*a=0 & *a#const int M=2,N=3;double Mean(double aMN, int m,int n ) double v=0;for(int i=0;iint FF(int a , int n)int mul=1; if(n=1)mul*=a0;else mul=an-1*FF(a,n-1); re。

4、turn mul;/*void main()int a6=1,2,3,4,5,6; printf(%dn,FF(a,6);*/#includevoid main()double sum=0;int n=1;while(true)if(sum + 1/(double)n 5)break;elsesum += 1/(double)n;n+;printf(%d, %lfn,n,sum);5、答案:#includevoid main()int s=0,i=2;dos+=i*i;if(s+(i+2)*(i+2)=1000)break;else i+=2;while(true);printf(i=%d,s。

5、=%d,i,s);6、答案:#includevoid main()int s=0,n;printf( 请输入 n 的值: ); scanf(%d,&n);for(int i=1;ivoid SB(char ch) switch(ch) case A: case a:printf(WW ); break;case B: case b:printf(GG ); break;case C: case c:printf(PP ); break;default:printf(BB ); break;void main() char a1 = b, a2 = C, a3 = f;SB(a1); SB(a2。

6、); SB(a3); SB(A); printf(n);2 程序代码:#include #include double SD(int a, int b, char op) double x;switch(op) case +: x = a + b; break;case -: x = a - b; break;case *: x = a * b; break;case /: if(b) x = (double)a/b; else exit(1); break; default: printf( 运算符错! n); exit(1); return x;void main() int x = 20。

7、, y = 8;printf(%3.2lf , SD(x, y, -);printf(%3.2lf , SD(x, y, *); printf(%3.2lfn, SD(x + y , y, /);3 程序代码:#include void WF(int x, int y) x = x + y;y = x + y;printf(subs: x, y = %d, %dn, x, y);void main() int x = 18, y = 23;printf(main: x, y = %d, %dn, x, y);WF(x, y);x = 2 * x;printf(main: x, y = %d, 。

8、%dn, x, y);4 程序代码:#include #include void fun(char ss);void main() char s15 = 567891234;fun(s);printf(%sn, s);void fun(char ss) int i, n = strlen(ss);for(i = 0; i void InsertSort(int a, int n)int i, j, x;for(i = 1; i = 0; j -) / 为 x 顺序向前寻找合适的插入位置11=h(xva 曰)atj + lTasewe breakaU + 17Xvoid main()宀in=in。

9、f asH 宀 203N 4, 39 28 注一nsertsort(B 6=for(i H 0二 A 6二 +) PHnH=%d=am)prww)6 -敲- #inc_ude csfdio-hvvoid main()宀inf as3&9 IT 1WIP 17 注inf L * p H Bfor(i H 0二 A 8二 +)宀PHnH=%5d=* p +) if(一 + I) 4 Hu 0) prinff3n=7. n #inc_ude csfdio-hv inf LA(inf * Binf n)宀 inf L s H for(一 H 0二 A n二 +) s +H ref urnwFovoid。

10、 main() int a = 5, 10, 15, 20, 25, 30 ;int b = LA(a, 4);int c = LA(a + 2, 3);printf(%d %dn, b, c);8 程序代码:#include int LB(int * a, int n) int i, s = 1;for(i = 0; i = k) c +;return c;3 程序代码:#include #include #include const int N = 10;int ff(int x, int y) int z;printf(%d + %d = , x, y);scanf(%d, &z);if。

11、(x + y = z) return 1; else return 0;void main() int i, a, b, c = 0;srand(time(0); / 初始化随机数序列for(i = 0; i #include void LI(int n) int * a = malloc(n * sizeof(int);int i;for(i = 0; i = 0; i -) printf(%d , * (a + i); printf(n);free(a);6 程序代码:int LK(double a, int n) double s = 0;int i, m = 0;for(i = 0; 。

12、i = s) m +; return m;参考答案:一、 1、答案:运行结果:GG PP BB WW2、答案:运行结果:12.00 160.00 3.503、答案:运行结果:main: x, y = 18, 23subs: x, y = 41, 64main: x, y = 36, 234、答案:运行结果:4321987655、运行结果:47 36 32 28 20 156、答案:运行结果:35791113 15 177、答案:运行结果:50 608、答案:运行结果:b=184二、1答案:在整型数组 a的前n个元素中查找值为 x的元素,找到返回 1找不到返回0。2、 答案:统计整型数组a 的前。

13、 n 个元素中不小于 k 的元素个数并返回3、 答案: 程序随机产生 10道 20以内整数加法题, 请用户回答。 并统计得分,4、答案: 调用 fun6(m, n, 2)求m和n的最小公倍数5、答案:读入 n 个整数,然后逆序输出第四次作业一、写出下列每个程序运行后的输出结果1 程序代码:#include struct Worker char name15; / 姓名int age; / 年龄float pay; / 工资;void main() struct Worker x = wanghua, 52, 2350 ;struct Worker y, * p;y = x; p = &x;pr。

14、intf(%s %d %6.2fn, y.name, y.age, y .pay); printf(%s %d %6.2fn, p-name, p-age + 1, p-pay + 20);2 程序代码:#include #include struct Worker char name15; / 姓名int age; / 年龄float pay; / 工资;void main() struct Worker x; char * t = liouting;int d = 38; float f = 493;strcpy(x.name, t);x.age = d; x.pay = f;x.age 。

15、+; x.pay *= 2;printf(%s %d %6.2fn, x.name, x.age, x.pay);3 程序代码:#include struct Worker char name15; / 姓名 int age; / 年龄 float pay; / 工资;int Less(struct Worker r1, struct Worker r2) if(r1.age name);p = f;while(- n) p = p-next = malloc(sizeof(struct StrNode); scanf(%s, p-name);p-next = NULL; return f;3。

16、 程序代码:int data; / 结点值域struct IntNode * next; / 结点指针域;struct IntNode * FindMax(struct IntNode * f)struct IntNode * p = f;if(! f) return NULL;f = f-next;while(f) if(f-data data) p = f;f = f-next;return p;4 * 程序代码:struct IntNode int data; / 结点值域struct IntNode * next; / 结点指针域 ;int Count(struct IntNode *。

17、 f)int c = 0;while(f) c +;f = f-next;return c;5 程序代码:struct IntNode int data; / 结点值域struct IntNode * next; / 结点指针域;struct IntNode * Input(int n)struct IntNode * f, * p;f = malloc(sizeof(struct IntNode);if(n = 0) return NULL;f-next = NULL;printf( 从键盘输入 %d 个整数: , n);while(n -) scanf(%d, &(f-data);p = 。

18、f;f = malloc(sizeof(struct IntNode); f-next = p;return f-next;6 程序代码:#include #include #include void JA(char * fname)FILE * fout = fopen(fname, w);char a20;printf( 输入若干个字符串,每个字符串长度小于20,字符串 end 作为结束标志 n);while(1) scanf(%s, a);if(strcmp(a, end) = 0) break;fputs(a, fout);fputc(n, fout);fclose(fout);voi。

19、d main()char * p = d:xxkxuxk1.txt;JA(p);参考答案:#1、答案:运行结果:wanghua 52 2350.00wanghua 53 2370.002、答案:运行结果:liouting 39 986.003、答案:运行结果:def 58 638.00二、1答案:从标准输入设备读入n-1个人员的信息,依次存到结构数组的a1 到an-1元素中2、 答案:创建具有n个struct StrNode结点的单向链表并返回其表头结点地址,n为0时返回NULL。3、答案:函数功能:查找单向链表中结点值域最大的结点,并返回其地址。如链表为空则返回NULL4、答案:函数功能:统计并返回单向链表结点个数5、答案:函数功能:从表尾结点开始, 逆序创建具有 n 个 struct IntNode 结点的单向链表并返回其表头结点地址, n 为 0时 返回 NULL6、答案:函数功能:将输入的若干个字符串保存到文本文件 d:xxkxuxk1.txt 中,每个字符串一行。 输入的单个字符串长度 必须小于 20,输入字符串 end 结束23。

c语言程序设计电大作业,电大C语言程序设计第1234次作业及答案相关推荐

  1. 电大1253c语言程序设计考试题,电大1253《C语言程序设计》开放大学期末考试试题2020年1月(含答案)...

    <电大1253<C语言程序设计>开放大学期末考试试题2020年1月(含答案)>由会员分享,可在线阅读,更多相关<电大1253<C语言程序设计>开放大学期末考试 ...

  2. c语言中使用的字符常量其起止标记符是,2021国家开放大学电大本科《C语言程序设计》期末试题及答案(试卷号:1253)...

    <2021国家开放大学电大本科<C语言程序设计>期末试题及答案(试卷号:1253)>由会员分享,可在线阅读,更多相关<2021国家开放大学电大本科<C语言程序设计& ...

  3. 【渝粤教育】电大中专学前儿童语言教育 (6)作业 题库

    作业视频教务托管,壹叁路路贰陆陆壹〇肆〇 下面哪个选项不是学前儿童语言获得理论( ). A.先天与后天相互作用论 B.遗传决定论 C.后天环境论 D.先天决定论 错误 正确答案:左边查询 学生答案:未 ...

  4. 【渝粤教育】电大中专学前儿童语言教育 (4)作业 题库

    作业视频教务托管,壹叁路路贰陆陆壹〇肆〇 认为儿童天生就有学习语言能力且体现在一种语言获得装置(LAD)中的教育家是( ). A.斯金纳 B.乔姆斯基 C.皮亚杰 D.伍顿 错误 正确答案:左边查询 ...

  5. 【渝粤教育】电大中专学前儿童语言教育 (2)作业 题库

    作业视频教务托管,壹叁路路贰陆陆壹〇肆〇 认为儿童天生就有学习语言能力且体现在一种语言获得装置(LAD)中的教育家是( ). A.皮亚杰 B.乔姆斯基 C.伍顿 D.斯金纳 错误 正确答案:左边查询 ...

  6. 【渝粤教育】电大中专学前儿童语言教育 (3)作业 题库

    作业视频教务托管,壹叁路路贰陆陆壹〇肆〇 认为儿童天生就有学习语言能力且体现在一种语言获得装置(LAD)中的教育家是( ). A.皮亚杰 B.伍顿 C.乔姆斯基 D.斯金纳 错误 正确答案:左边查询 ...

  7. 【渝粤教育】电大中专学前儿童语言教育 (11)作业 题库

    作业视频教务托管,壹叁路路贰陆陆壹〇肆〇 下面哪个选项不是学前儿童语言获得理论( ). A.先天与后天相互作用论 B.遗传决定论 C.先天决定论 D.后天环境论 错误 正确答案:左边查询 学生答案:A ...

  8. 兰州大学C语言程序设计课程作业,兰州大学C语言程序设计课程作业1附答案.doc...

    兰州大学C语言程序设计课程作业1附答案.doc C 语言程序设计课程作业语言程序设计课程作业_A 历次成绩 完成时间 查看详情 1.0.0 2015-11-21 091531 2.0.0 2015-1 ...

  9. c语言书面作业3,C语言程序设计

    软件学院<C语言程序设计>课程教学大纲 课程名称C语言程序设计 英文名称C Programming Language 适用专业软件工程 课程编码20H15281开课学期1学分/周学时4/ ...

最新文章

  1. SpringMVC js如何获取后台model中的属性值
  2. php json.parse,PHP JSON头导致JSON.parse出错(使用jQuery)
  3. 源码分析 vue-cli 中安装依赖
  4. IAR环境下STM32+IAP方案的实现(转)
  5. c语言 两个文件相似度比较,某课程设计---文件相似度判断
  6. php自动运维,运维自动化之使用PHP+MYSQL+SHELL打造私有监控系统(五)
  7. 已安装Anaconda情况下,命令行pip,python报错(详细 已解决)
  8. ubuntu 18.04使用sysbench测试MySQL性能
  9. JS正则表达式(RegExp)
  10. Mapreduce和Yarn概念,参数优化,作用,原理,MapReduce计数器 Counter,MapReduce 多job串联之ControlledJob(来自学习资料)...
  11. Win2003 Server磁盘配额揭密启用篇
  12. 联想云计算机终端,联想云桌面
  13. 魔兽怀旧服最新服务器人口,魔兽世界怀旧服人口普查最新1月_2021wow怀旧服人口普查数据一览_3DM网游...
  14. QTcpSocket使用发现的问题
  15. Github文件夹下载到本地
  16. Illegal group reference:非法组引用异常
  17. Android wifi 信号强度单位 dbm
  18. 壕无人性!有公司年终奖发了50个月薪水?!
  19. R语言 如何合并csv文件(批量读取csv文件)
  20. layui table 获取单元格总是多一个

热门文章

  1. C语言中的scanf()函数介绍
  2. ffmpeg php 抠像_PHP中使用ffmpeg截取视频图片笔记
  3. BEBLID:增强的高效局部图像特征描述符
  4. 基于局部表面特征在杂乱场景中的三维物体识别
  5. 蚂蚁上市挂牌,员工激励人均超800万,你以为创业真的那么容易么?
  6. 再也不怕复现论文!arXiv携手Papers with Code,提交论文+上传代码一步到位
  7. spark广播变量的原理_spark使用广播变量
  8. np.reshape 中的 -1 参数
  9. 深度学习入门课程推荐
  10. RStudio个性化界面配置