0

Hi All...

I just started taking CIS 1030 .. the fundamentals of programming. Right now we are just learning the basics and haven't started to program in any language... just flow charts.

My current assignment is to write a program that inputs one number at a time from the user, and then outputs only the min/max of all the numbers entered. Then stop. The user determines the amount of numbers they want to input.
If anyone can help with this.. I'd appreciate it!

5
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by firstPerson
0

>If anyone can help with this.. I'd appreciate it!
This is a very simple algorithm that requires little more than common sense. Just pretend someone is handing you money and that you get to keep the smallest and largest bills. When you're done outlining the steps, turn the process into a flow chart.

It may sound harsh, but if you can't figure this one out, you might want to consider switching your major. It doesn't get any easier.

Edited by Narue: n/a

0

This is a very simple algorithm that requires little more than common sense. Just pretend someone is handing you money and that you get to keep the smallest and largest bills. When you're done outlining the steps, turn the process into a flow chart.

It may sound harsh, but if you can't figure this one out, you might want to consider switching your major. It doesn't get any easier.

I doubt the OP is struggling with doing this conceptually. He/she is probably confused about what a flowchart is, as simple as a flowchart is. . that is a different story.

http://en.wikipedia.org/wiki/Flowchart

0

I doubt the OP is struggling with doing this conceptually. He/she is probably confused about what a flowchart is, as simple as a flowchart is. . that is a different story.

http://en.wikipedia.org/wiki/Flowchart

I actually do know what a flowchart is and am just learning the fundamentals. It seemed simple at first, but when i put it on paper it was a little more confusing.

The exact assignment is this:
In this program, ask the user for numbers, one at a time. Determine the smallest and largest number the user input. Do you think you will require a counter? Will you need an accumulator? Because the user is entering numbers one at at time, you must decide on some method of determining when to stop asking for more numbers. Keep in mind that the user can enter only one number.

This is what I have so far:

1. start
2. initialization: max<infinity, min>infinity,
3. output: 'enter a number'
4. input: n1
5. output:'enter another number or Q to quit'
6. input: n2
7. decision: num2=Q? T:output n1 then stop
F:decision: n2>n1?
T: n1=min n2=max if not then n2=min and n1=max

8. output: enter another number or Q to quit
9.input: n3
10: decision: is n3>n2 if true then

and this is where i get confused. i know i must be missing something, but i don't know what that is.. and how do i loop it around to the Q=Q to end if it does... did i put that in the wrong place?
And thank you for at least trying to help me with this.. and not just posting a response that was useless. I hope you get what i was saying up there... like I said, i'm new to the community and c.s in general.. so i apologize in advance if it doesn't make sense to you!

0

How about
1 Start
2 Ask for a number
3 Set min & max to number
4a Request new number
4b Check new number vs 'Q', if so then stop doing 4 commands
4c Check min vs new number
4d Check max vs new number
4e Start again at 4a
5 Print max and min

This isn't radically different, you just missed the looping in the translation from flowchart to command list

Edited by ackondro: n/a

0

How about
1 Start
2 Ask for a number
3 Set min & max to number
4a Request new number
4b Check new number vs 'Q', if so then stop doing 4 commands
4c Check min vs new number
4d Check max vs new number
4e Start again at 4a
5 Print max and min

This isn't radically different, you just missed the looping in the translation from flowchart to command list

Thank you so much for your response. this actually would've been the perfect answer. i turned in my flowchart on friday... so we'll see how i did... thanks again!

0

>>It may sound harsh, but if you can't figure this one out, you might want to consider switching your major. It doesn't get any easier.

Well not everyone can be like us :).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.