15,881,033 members
1.00/5 (1 vote)
See more:
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) *

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.
Posted
Updated 8-Oct-17 14:37pm
Richard MacCutchan 8-Oct-17 15:38pm
Try thinking about how you would do it manually. Write down the steps you need to perform and then turn those steps into code.

## Solution 1

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!

## Solution 2

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

## Solution 3

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.

Quote:
basically i tried for loops and if statement.

basically, it is the solution.
- 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.