Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Jun 28th, 2006, 5:11 PM   #1
Edgar.
Newbie
 
Edgar.'s Avatar
 
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0 Edgar. is on a distinguished road
smallest number....

Hi I need to perform this:
Double the 2 smallest numbers and add that sum to the largest, but I need to know the smallest number from an input divice.
Edgar. is offline   Reply With Quote
Old Jun 28th, 2006, 5:29 PM   #2
Edgar.
Newbie
 
Edgar.'s Avatar
 
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0 Edgar. is on a distinguished road
DaWei can you help me?
Edgar. is offline   Reply With Quote
Old Jun 28th, 2006, 5:33 PM   #3
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 747
Rep Power: 3 Jimbo is on a distinguished road
have you come up with an algorithm or some pseudo code yet?

Oh, and we don't always reply within 20 minutes of your post. Some of us do have other things going on than sitting here, refreshing every couple minutes, and hoping for a new thread.
Jimbo is offline   Reply With Quote
Old Jun 28th, 2006, 5:39 PM   #4
Edgar.
Newbie
 
Edgar.'s Avatar
 
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0 Edgar. is on a distinguished road
[HTML]
.code
getnum proc
@@Height:
mov dx,offset msg1 ;get Height
call pstring
call getdec ;make shure height are between 1 and 100
cmp ax,0
jz @@ok
cmp ax,1
jb @@bad
cmp ax,100
ja @@bad
jmp @@ok
@@bad:
mov dx,offset complain
call pstring
jmp @@Height
@@ok:
cmp ax,0
mov val1,ax
ret
getnum ENDP

next proc
@@Length:
mov dx,offset msg2 ;ger Length
call pstring
call getdec
cmp ax,0 ;make shure length is between 1 and 100
jz @@ok
cmp ax,1
jb @@bad
cmp ax,100
ja @@bad
jmp @@ok
@@bad:
mov dx,offset complain
call pstring
jmp @@Length
@@ok:
cmp ax,0
mov val2,ax
next ENDP ;if is right how can I know the smallest number? [/HTML]
Edgar. is offline   Reply With Quote
Old Jun 28th, 2006, 6:07 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
The smallest number depends entirely upon your implementation (if you subscribe to the notion that negative numbers are smaller than zero, as I do). Each implementation usually has a header file defining the limits of such things. "Smallest" is a superlative. There cannot be two (different) 'smallest' numbers.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jun 28th, 2006, 8:25 PM   #6
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: olympia,WA
Posts: 332
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
I dont know ASM but cant you make a list of the numbers then sort that list so the first or last numbers are the smallest and then grab those numbers? maybe try doing the ordering function in high level then porting it to ASM.
__________________
i dont know much about programming but i try to help
mrynit is offline   Reply With Quote
Old Jun 28th, 2006, 11:13 PM   #7
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 416
Rep Power: 3 Wizard1988 is on a distinguished road
Send a message via AIM to Wizard1988
You should take a look at this Instruction table. I have one printed and accesible at all times
Wizard1988 is offline   Reply With Quote
Old Jun 29th, 2006, 12:11 AM   #8
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
Quote:
Originally Posted by mrynit
I dont know ASM but cant you make a list of the numbers then sort that list so the first or last numbers are the smallest and then grab those numbers? maybe try doing the ordering function in high level then porting it to ASM.
When you know what you're looking for, a list is pointless. Keep only enough variables for what you want to end up with, and compare each new value to see if it should take the place of what's in the variables. At the end, you should end up with what you want.
__________________

tempest is offline   Reply With Quote
Old Jun 29th, 2006, 12:26 AM   #9
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: olympia,WA
Posts: 332
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
yeah that right, i was just thinking more about order or numbers.
__________________
i dont know much about programming but i try to help
mrynit 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 6:48 AM.

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