条形图C ++需要帮助asap [英] Bar chart C++ need help asap

查看:79
本文介绍了条形图C ++需要帮助asap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在大学里有这个小项目,我无法弄清楚..所以基本上程序是用户应该输入7天的PSI而且条形图应该显示空气是多么健康....例如 -



Psi第1天:200

PSI第2天:450

PSI日3:200

Psi第4天:664

Psi第5天:467

Psi第6天:876

Psi第7天:375



所以条形图就像



200-300是一个astrick

300-400是一个傻瓜等等......所以7个中有3个数字落在200-300的范围内,条形图显示3个astricks。



健康(200-300)*

不健康(300-400)*

非常糟糕(400-900)***



我尝试了什么:



尝试的东西无法获得它工作删除了一切...基本上我尝试循环和如果声明...尝试虽然但不知道如何你se any tbh。

解决方案

我们不做你的作业:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



只是说哦,我试过了,但它没有用,所以我删除它切断我们的冰块!亲自尝试一下,你可能会发现它并不像你想象的那么困难!



如果你遇到一个具体的问题,那么请询问一下,我们会尽力而为帮助。但是我们不打算为你做这一切!


你知道,它只能用 if chain 进行编码,例如参见 C ++:If和Else Statements [ ^ ]


< blockquote class =quote>

引用:

所以我在大学里有这个小项目,我无法弄清楚..



我们不做你的HomeWork,所以没有代码。这个论坛是为了帮助程序员修改自己的代码。

Quote:

尝试过的东西无法让它工作删除所有东西。



由于你没有展示你的代码,试图帮助你是一个猜谜游戏。

Quote:

基本上我试过循环和if语句。



基本上,它就是这样lution。

建议:

- 学习调试器,它会告诉你你的代码是一步一步做的,这是一个很好的学习工具,它将帮助您了解代码中出现的问题。



有一个工具可以让你看到你的代码在做什么,它的名字是调试的。它也是一个很好的学习工具,因为它向你展示了现实,你可以看到哪种期望与现实相符。

当你不明白你的代码在做什么或为什么它做它做的时候,答案就是答案是调试器

使用调试器查看代码正在执行的操作。只需设置断点并查看代码执行情况,调试器允许您逐行执行第1行并在执行时检查变量。



调试器 - 维基百科,免费的百科全书 [ ^ ]



掌握Visual Studio 2010中的调试 - 初学者指南 [ ^ ]

使用Visual Studio 2010进行基本调试 - YouTube [ ^ ]

调试器在这里向您展示您的代码正在做什么,您的任务是与什么进行比较应该这样做。

调试器中没有魔法,它没有找到错误,它只是帮助你。当代码没有达到预期的效果时,你就会接近一个错误。


so i have this little project at college and i can't figure it out..so basically the program goes that the user is supposed to enter PSI of 7 days and the bar chart is supposed to show how healthy the air is....example -

Psi day 1 :200
PSI day 2 :450
PSI day 3:200
Psi day 4 :664
Psi day 5 :467
Psi day 6 :876
Psi day 7 :375

so the bar chart goes like

200-300 is one astrick
300-400 is one astick and so on... so is there are 3 numbers out of 7 that fall under the range of 200-300 the bar chart shows 3 astricks.

healthy(200-300) *
unhealthy (300-400) *
very bad (400-900) ***

What I have tried:

tried stuff couldn't get it to work deleted everything...basically i tried for loops and if statement...tried while but didnt know how to use any tbh.

解决方案

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

And just saying "oh, I tried it, but it didn't work so I deleted it" cuts no ice with us! Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!


You know, it can be coded with just an if chain, see, for instance C++: If and Else Statements[^]


Quote:

so i have this little project at college and i can't figure it out..


We do not do your HomeWork, so no code.This forum is to help programmers to fix their own code.

Quote:

tried stuff couldn't get it to work deleted everything.


Since you didn't showed your code, trying to help you is a guessing game.

Quote:

basically i tried for loops and if statement.


basically, it is the solution.
Advice:
- Learn debugger, it will show you what you code is doing step by step, it is a great learning tool, it will help you to understand what goes wrong in your code.

There is a tool that allow you to see what your code is doing, its name is debugger. It is also a great learning tool because it show you reality and you can see which expectation match reality.
When you don't understand what your code is doing or why it does what it does, the answer is debugger.
Use the debugger to see what your code is doing. Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute.

Debugger - Wikipedia, the free encyclopedia[^]

Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
Basic Debugging with Visual Studio 2010 - YouTube[^]
The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't find bugs, it just help you to. When the code don't do what is expected, you are close to a bug.


这篇关于条形图C ++需要帮助asap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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