程序设计 [英] Programming

查看:93
本文介绍了程序设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是不理解我的任务。有人可以向我解释我想要做什么。

I just don''t understand my assignment. Can someone explain to me what I am suppose to be doing.

推荐答案


我只是不明白我的分配。有人可以向我解释我想要做什么。
I just don''t understand my assignment. Can someone explain to me what I am suppose to be doing.



什么是程序规范?

what is the program specification?


编写执行以下操作的程序。

1.反复阅读学生分数(考试)并将其添加到运行总和中。计算输入的分数。 (我们假设分数在0到100之间。)当用户输入负数时停止。输出分数的总和和计数。

2.定义一个函数平均值,通过分数总和和分数计算,计算它返回的平均分数。在main中,在上述循环之后调用此函数,并输出函数返回的平均分数。

3.定义一个函数validScore,如果得分在0到100之间,则返回true,否则返回false。使用此功能,修改读取分数的循环,这样,如果分数无效,则会回显一条消息,说明分数无效,以便分数计算并仅在分数时加到总和中。已验证。 (请注意,由于在输入负分数时循环退出,因此有一些冗余,因为有效分数?因此,validScore永远不会传递无效的分数,因为它是负数。)

4.定义函数letterGrade,通过有效分数(0到100之间),按照以下时间表返回一个字母等级:

?A ?:90以上

?B?:80-89

?C?:70-79

?D?:60-69

?F?:下面60

使用此功能查找与每个有效分数对应的字母等级,并在找到后立即输出字母等级。保持每个字母等级的数量(?A? - ?F?),并在运行结束时输出每个计数。
Write a program that does the following.
1. Repeatedly read a student score (for an exam) and add it to a running sum. Count the number of scores entered. (We?ll assume that the scores are between 0 and 100.) Stop when the user enters a negative number. Output the sum and count of the scores.
2. Define a function average that, passed the sum of the scores and the count of the scores, computes the average score, which it returns. In main, call this function just after the above loop, and output the average score that the function returns.
3. Define a function validScore that, passed a score, returns true if the score is between 0 and 100 and otherwise returns false. Using this function, modify the loop that reads in the scores so that, if the score is not valid, it is echoed with a message saying that the score is invalid, and so that the score is counted and added to the sum only when it is valid. (Note that there is some redundancy as validScore is used here since the loop exits when a negative score is entered?so validScore is never passed a score that is invalid because it is negative.)
4. Define a function letterGrade that, passed a valid score (one between 0 and 100), returns a letter grade according to the following schedule:
?A?: 90 and above
?B?: 80-89
?C?: 70-79
?D?: 60-69
?F?: below 60
Use this function to find the letter grade corresponding to each valid score and output the letter grade as soon as it is found. Keep a count of the number of each letter grade (?A?-?F?) and output each count at the end of the run.



编写执行以下操作的程序。

1.反复阅读学生分数(考试)并将其添加到运行总和中。计算输入的分数。 (我们假设分数在0到100之间。)当用户输入负数时停止。输出分数的总和和计数。


Write a program that does the following.
1. Repeatedly read a student score (for an exam) and add it to a running sum. Count the number of scores entered. (We?ll assume that the scores are between 0 and 100.) Stop when the user enters a negative number. Output the sum and count of the scores.
.



最初只做第1部分 - 有一个循环从键盘读取数字,如果数字为负则退出循环,否则将值添加到运行总和和增量分数。


当工作正在进行到第2部分等时

initially just do part 1 - have a loop which reads number from the keyboard, if the number is negative exit the loop otherwise add the value to the running sum and increment the count of scores.

when that is working move on to part 2, etc.


这篇关于程序设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆