- 6
- 0
- 约1.29万字
- 约 36页
- 2017-06-08 发布于河南
- 举报
程序改错题new-答案(国外英文资料)
程序改错题new-答案(国外英文资料)
1. program debugging questions 1 (X_2_1.C)
The following requirements: debugging procedures can not get the correct results, it contains 2 errors, please press the question of functional requirements, debug and modify the program (/*modified*/ on the modified statement after the notes), the operation can get the correct results. Save the results (including the X_2_1.C file and the X_2_1.EXE file) to the directory C:\KS\.
Function Description: calculates the area of a circle with a radius of 1~n and prints only more than 50 of the area of the circle.
For example, enter: 6
Then output:
R=4, square=50.265488
R=5, square=78.539825
R=6, square=113.097351
Error primitive:
#include stdio.h
(main)
{
Int, R, n;
Float area;
Scanf (%d, n);
For (r=1, r=n, r++)
{
Area=3.141593*r*r;
If (area50.0) continue;
Printf (r=%d, square=%d\n, R, area);
}
Getch ();
}
Answer
#include stdio.h
(main)
{
Int, R, n;
Float area;
Scanf (%d, n);
For (r=1; r=n; r++) /*modified*/
{
Area=3.141593*r*r;
If (area50.0) continue;
Printf (r=%d, square=%f\n, R, area); /*modified*/
}
Getch ();
}
2. program transfer questions 2 (X_2_2.C)
The following requirements: debugging procedures can not get the correct results, it contains 3 errors, please press the question of functional requirements, debug and modify the program (/*modified*/ on the modified statement after the notes), the operation can get the correct results. Save the results (including the X_2_2.C file and the X_2_2.EXE file) to the directory C:\KS\.
Function Description: the input decimal integer n through function DtoH converted to sixteen hexadecimal number, and the conversion results in string form output.
Such as input: 79, output: 4F
Input again: 1234 output: 4D2
Error primitive (see C:\KS\X_2_2.C):
#include stdio.h
Int DtoH (int, N, char, *str)
{
Int, I, d;
For (i=0, N, =0, i++)
{
D=n%16;
If (d=10)
Str[i]=0+d;
Else
Str[i]=A+d-10;
N/=16;
}
Return i;
}
(main)
{
Int, I, K, n;
Char str[80];
Scanf (%d, n);
K=DtoH (n, STR);
For
您可能关注的文档
- 浅谈商务英语情况下礼貌绳尺在女性言语中的应用(国外英文资料).doc
- 浅谈小学数学计算教授教化计谋新思虑(国外英文资料).doc
- 浅谈小学略读课文的主要性(国外英文资料).doc
- 浅谈孩子长大中怙恃的角色(国外英文资料).doc
- 浅谈小学数学教员教授教化措辞的特色(国外英文资料).doc
- 浅谈小学英语单词记忆法(国外英文资料).doc
- 浅谈小学英语教室中的措辞输进与输进(国外英文资料).doc
- 浅谈小学英语教室措辞输进有效性的提高和计谋(国外英文资料).doc
- 浅谈小学英语教室新讲课的有效导进(中间小学赵尚梅微课题)(国外英文资料).doc
- 浅谈小学英语教室教授教化法(国外英文资料).doc
- 2025年全国演出经纪人员资格认定考试试卷带答案(研优卷).docx
- 2025年全国演出经纪人员资格认定考试试卷完整版.docx
- 2025年全国演出经纪人员资格认定考试试题库及完整答案.docx
- 2025年全国演出经纪人员资格认定考试试卷完美版.docx
- 2025年全国演出经纪人员资格认定考试试卷含答案(实用).docx
- 2025年全国演出经纪人员资格认定考试试卷及答案(各地真题).docx
- 2025年下半年内江市部分事业单位公开考试招聘工作人员(240人)备考题库附答案.docx
- 2025年全国演出经纪人员资格认定考试试卷及答案1套.docx
- 2025年下半年四川成都市郫都区面向社会引进公共类事业单位人员2人备考题库最新.docx
- 2025年下半年内江市部分事业单位公开考试招聘工作人员(240人)备考题库附答案.docx
最近下载
- 微机电系统MEMS简介课件.ppt VIP
- 大型活动交通需求预测和其交通组织管理方法研究.pdf VIP
- 苏州工业职业技术学院单招《数学》题库(精选题)附答案详解.docx VIP
- 共点力平衡的七大题型-Word版含解析.pdf VIP
- 人教版小学数学一年级口算比赛题库[全套].doc VIP
- 交通组织设计与优化.pptx VIP
- 2026年CNAS_认可评审员应知应会考点练习题及答案.docx VIP
- AP统计学 2012年真题 附答案和评分标准 AP Statistics 2012 Real Exam with Answers and Scoring Guidelines.pdf VIP
- 专题04 连接体模型(原卷版).docx VIP
- (完整版)mems简介课件.pptx VIP
原创力文档

文档评论(0)