Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
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) *
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.
Posted
Updated 8-Oct-17 14:37pm
Comments
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.

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!
 
Share this answer
 
You know, it can be coded with just an if chain, see, for instance C++: If and Else Statements[^]
 
Share this answer
 
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900