Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

program question

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
need to get 3 numbers in numerical using if statements and not using and or or example you input 3 1 2 the program would print 1 2 3
 
Your question is not very clear. Do you mean you want the numbers sorted?

There are plenty of easy-to-use sort progs available.
 
This sounds like a homework question. What have you done so far? Do you have anything? Like actual code or even psuedo code that you may have considered? --MiggyD

Never be afraid to try something new. Remember that amateurs built the Ark. Professionals built the Titanic.
 
Take a look at the SWAP statement, make a couple of loops that compare the three variable and then move them around. You should be able to do this in 10 lines or so
 
First you need to find out how to use the Sort Commands, Then you sort by CHR$ statements, which is the number in which each key is assigned. Look in help:contents, then look for Sorting commands, and then CHR$ info. This will hopefully show you how to sort what the person inputs, in the memory, then print out in numerical order.
 
To be honest, I don't see what [tt]CHR$()[/tt] has to do with sorting... There is no [tt]CHR$[/tt] statement, by the way; it is a function that takes an integer and returns a string.
 
I tried it and got it in 4 lines! you need to use comparisons, SWAP, and DO-LOOP UNTIL
 
You got in 4 lines what you THINK clipjoint was doing. Was the 123 in a single string? an array? or were they separate integers?

As he hasn't told you this info, how do you know how to handle them?
 
in an array, the actual sorting took 4 lines, the whole program (the input included)was 11 lines. This seems to be the easiest and and quickest way to do it
 
This is exactly the reason I asked "clipjoint3" to post some code.

Guess clipjoint3 found the answer s/he was looking for. --MiggyD

Never be afraid to try something new. Remember that amateurs built the Ark. Professionals built the Titanic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top