Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Variable changing- HELP!
Old
jmac
Guest
 
Status:
Posts: n/a
Default Variable changing- HELP! - 10-16-2009, 10:18 PM

Ok so what I,m trying to do is calculate the difference between the numbers the user puts in. Basically what my program is supposed to do is allow the users to enter numbers, and then when they do not want to add more numbers, the program is supposed to find the difference between the highest and lowest number. Any ideas on how to do this are appreciated!

This is what i have now:
Attached Files
File Type: a2w Spooky Scary v2.a2w (1.80 MB, 4 views)
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 10-17-2009, 03:09 AM

Sorting numbers properly is actually a fairly complex subject. I've written an example of the sorting method called Bubblesort, which is the slowest and simplest sorting method.

It'll ask if you want another number. Click yes to add one, click no to activate the sorting method (I recommend only about 5 numbers, as more may make the 3d text go off screen).

The first text displayed will show the unsorted list. The second one will show the sorted list, and the last one will show the difference between the highest and lowest numbers.
Attached Files
File Type: a2w bubbleSort.a2w (270.8 KB, 48 views)
   
Reply With Quote
Reply

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



Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.