这个问题对我有什么影响? [英] What does this problem ask of me?

查看:85
本文介绍了这个问题对我有什么影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是整个问题:



写一个函数图,它将绘制由另一个函数计算的值,每行星号对应一个星号,每个星号对应一个值0.1。因此,1将显示10行星号,0.5行一行5个星号,2行一行20个星号等。将要绘制的函数作为函数图的第一个参数传递。作为绘制函数的函数的示例,函数sumSequence1(int count)将计算并返回序列1-1 / 3 + 1 / 5- 1/7 + 1/9中的第一个计数项的总和。 。使用迭代。例如,sumSequence(3)应计算总和1-1 / 3 + 1/5,sumSequence(5)应计算总和1-1 / 3 + 1 / 5- 1/7 + 1/9。作为函数图的第二个和第三个参数,提供count的最小值和最大值,您可以使用它绘制第一个参数并绘制返回的值。因此,如果plot的第一个参数是sumSequence1,第二个是3,第三个是6,你的函数图应该调用sumSequence(3),sumSequence(4),sumSequence(5)和sumSequence(6)并打印4行星号显示每次调用返回的值。作为绘制实现函数sumSequence2(int count)的函数的第二示例,其将计算并返回序列1 + 1/3 + 1/5 + 1/7 + 1/9中的第一计数项的总和。 ..使用递归,而不是迭代。



告诉我我要做什么以及它对我有什么要求。我一直在拉着我的头发试图理解老师的可怕方向。



我尝试过的事情:



阅读问题,向老师寻求帮助(他说只是再读一遍),由于缺乏理解而没有尝试过。

Here's the entire problem:

Write a function plot that will plot the values calculated by another function with rows of asterisks, each asterisk corresponding to the value 0.1. So 1 will be shown with a line of 10 asterisks, 0.5 with a row of 5 asterisks, 2 with a row of 20 asterisks etc. Pass the function that you want to plot as the first argument of the function plot. As an example of a function to plot implement the function sumSequence1(int count) that will calculate and return the sum of the first count terms in the sequence 1-1/3+1/5- 1/7+1/9... using iteration. For example, sumSequence(3) should calculate the sum 1-1/3+1/5, sumSequence(5) should calculate the sum 1-1/3+1/5- 1/7+1/9. As a second and third argument of function plot supply the minimum and the maximum values of count, for which you wand plot to call its first argument and plot the value returned. So if the first argument of plot is sumSequence1, the second is 3, the third is 6, your function plot should call sumSequence(3), sumSequence(4), sumSequence(5), and sumSequence(6) and print 4 lines of asterisks showing the values returned by each call. As a second example of a function to plot implement function sumSequence2(int count), which will calculate and return the sum of the first count terms in the sequence 1+1/3+1/5+1/7+1/9... using recursion, not iteration.

Tell me exactly what I gotta do and what it wants from me. I've been pulling my hair trying to understand this teacher's horrible directions.

What I have tried:

Reading the question, asking for teacher for help (he said to just read it again), haven't attempted it due to lack of understanding.

推荐答案

如果你只是读它就很清楚了。

It's pretty clear if you just read it.
引用:

写一个函数图将绘制由另一个函数计算的值,并使用星号行,每个星号对应于值0.1。因此1将显示10行星号,0.5行一行5个星号,2行20行星号等。

Write a function plot that will plot the values calculated by another function with rows of asterisks, each asterisk corresponding to the value 0.1. So 1 will be shown with a line of 10 asterisks, 0.5 with a row of 5 asterisks, 2 with a row of 20 asterisks etc.



所以你需要编写一个名为<的函数code> plot

它应绘制由另一个函数计算的值,星号行

每个星号对应的值为0.1。所以1将显示10行星号,0.5行一行5个星号,2行20行星等。



所以你需要要么传递一个函数指针,它返回一组结果,或结果本身,取决于你的课程有多远 - 检查你的最后一套课程笔记,看看老师在讨论什么。



如果您不理解其余的指示,请与您的导师联系。


So you need to write a function called plot
It should plot the values calculated by another function with rows of asterisks
Each asterisk corresponding to the value 0.1. So 1 will be shown with a line of 10 asterisks, 0.5 with a row of 5 asterisks, 2 with a row of 20 asterisks etc.

So you need to either pass it a function pointer that returns a set of results, or the results themselves, depending on how far your course has got - check your last set of course notes and see what the teacher was discussing.

If you don't understand the rest of the directions, then talk to your tutor.


不是解决方案,只是建议。

Not a solution, just advices.
引用:

我一直在拉着我的头发试图理解老师的可怕方向。

I've been pulling my hair trying to understand this teacher's horrible directions.



这个要求没有什么可怕的,可能比平常要复杂一点。

实际上这个要求没有现实生活要求那么复杂。你只需要整理东西,没有陷阱,整个要求都有意义。


There is nothing horrible in this requirement, just may be a little more complicated than usual.
In fact this requirement is nowhere as complicated as real life requirements. You just have to organize things, there is no trap, the whole requirement makes sense.

引用:

eacher for帮助(他说只是再读一遍),由于缺乏理解而没有尝试过。

eacher for help (he said to just read it again), haven't attempted it due to lack of understanding.



这种态度让你在未来艰难的日子里承诺。

事实上,这是一个非常明智的建议,当你不理解某事,再读,组织你理解的东西,并在必要时重复。

当你真的被卡住时,请求帮助解决你遇到的困难。



作为程序员,分析需求并理解它们是你的工作。当某些内容不一致时,请公开问题并要求澄清。


This kind of attitude is promising you hard days in future.
In fact it is a very sensible advice, when you don't understand something, read again, organize what you understood, and repeat when necessary.
When you are really stuck, ask for help on what you have difficulties.

As programmer, it is your job to analyze requirements and make sense of them. When something is inconsistent, expose the problem and ask for clarifications.


这篇关于这个问题对我有什么影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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