Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 13th, 2005, 9:03 PM   #1
mapster123
Newbie
 
Join Date: Feb 2005
Posts: 2
Rep Power: 0 mapster123 is on a distinguished road
Help with some algorithm questions

Hello everyone,

I have two questions that need assistance with

1. Create an algorithm to input a series of positive and negative numbers (integers) and to display the highest and lowest values found. The input process is to end with an input of 999 and this value is not to be included in the calculations.

Eg. an input series of 6,100,-35,47,0,203,-16,999

would produce a display of Max 203 Min -35

2. Create an algorithm to accept a series of numbers whose values fall within range 1 to 5 inclusive. Input is to end when an input value of 999 is encountered - which is not to be included in the calculations. Any value outside the range of allowed values is to be ignored.
mapster123 is offline   Reply With Quote
Old Feb 13th, 2005, 9:08 PM   #2
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
It doesn't sound too difficult. Which part exactly do you need help with? I would just use to addresses, one two hold max and one to hold minimum, and read the input. If the input is bigger than max, then set max to the input, and if the input is less than min, set min to the input.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower

Last edited by Mjordan2nd; Feb 14th, 2005 at 6:47 AM.
Mjordan2nd is offline   Reply With Quote
Old Feb 14th, 2005, 3:41 AM   #3
mapster123
Newbie
 
Join Date: Feb 2005
Posts: 2
Rep Power: 0 mapster123 is on a distinguished road
I need help in both questions 1 and 2. Without knowing what the maximum and the minimum is?
mapster123 is offline   Reply With Quote
Old Feb 14th, 2005, 4:55 AM   #4
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
he just gave you the answer, check input against current max and min if less then min make min = new input or if input > max dp the same.
Berto is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:11 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC