Jasoni22
03-31-2002, 01:08 PM
OK, I've almost finished the program for the Advanced WebDev class. However, I've got one problem with it. It finds all the fractions and properly reduces them, put I'm having trouble putting them in ascending order. Right now, if you entered 6, you'd get:
1/6 1/3 1/2 2/3 5/6 1/5 2/5 3/5 4/5 1/4 1/2 3/4 1/3 2/3 1/2
I've gotten it to compare two consecutive fractions using ad<bc but when that returns false, I don't know how to keep that fraction for later use. So using this flawed subroutine, I get, with 5:
(strikethrough=not printed, just there to show what happens)
1/5 2/5 3/5 <s>4/5</s> 1/4 1/2 <s>3/4</s> 1/3 <s>2/3</s> 1/2
Or, it basically prints all the fractions except for (x-1)/x which is obviously not less than the next fraction of 1/(x+1)
http://campcaen.engin.umich.edu/iB_html/non-cgi/emoticons/mad.gif
I hope my explanations were clear and not confusing (I doubt it, though). I'm writing the program in C++. If anyone out here knows how to do this or can give me some hints, I'd greatly appreciate it. All my contact info should be filled in.
Thanks,
Jason
*note*
When you CHECK LENGTH on your Edit Profile screen, it tells you the maximumm length. I always thought it had only one m at the end. http://campcaen.engin.umich.edu/iB_html/non-cgi/emoticons/wink.gif
1/6 1/3 1/2 2/3 5/6 1/5 2/5 3/5 4/5 1/4 1/2 3/4 1/3 2/3 1/2
I've gotten it to compare two consecutive fractions using ad<bc but when that returns false, I don't know how to keep that fraction for later use. So using this flawed subroutine, I get, with 5:
(strikethrough=not printed, just there to show what happens)
1/5 2/5 3/5 <s>4/5</s> 1/4 1/2 <s>3/4</s> 1/3 <s>2/3</s> 1/2
Or, it basically prints all the fractions except for (x-1)/x which is obviously not less than the next fraction of 1/(x+1)
http://campcaen.engin.umich.edu/iB_html/non-cgi/emoticons/mad.gif
I hope my explanations were clear and not confusing (I doubt it, though). I'm writing the program in C++. If anyone out here knows how to do this or can give me some hints, I'd greatly appreciate it. All my contact info should be filled in.
Thanks,
Jason
*note*
When you CHECK LENGTH on your Edit Profile screen, it tells you the maximumm length. I always thought it had only one m at the end. http://campcaen.engin.umich.edu/iB_html/non-cgi/emoticons/wink.gif