![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0
![]() |
DaWei can you help me?
|
|
|
|
|
|
#3 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 742
Rep Power: 3
![]() |
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. |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Jun 2006
Location: Bath Room
Posts: 11
Rep Power: 0
![]() |
[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] |
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
|
|
#6 |
|
Hobbyist Programmer
|
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 |
|
|
|
|
|
#7 |
|
Professional Programmer
|
You should take a look at this Instruction table. I have one printed and accesible at all times
![]() |
|
|
|
|
|
#8 | |
|
Programming Guru
![]() |
Quote:
__________________
|
|
|
|
|
|
|
#9 |
|
Hobbyist Programmer
|
yeah that right, i was just thinking more about order or numbers.
__________________
i dont know much about programming but i try to help |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|