It is currently Wed May 07, 2025 12:40 pm View unanswered posts | View active topics |


Board index » Community » Community Discussion


Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: C++ Help
PostPosted: Thu Feb 01, 2007 9:19 am 
Spammer, to the max!
User avatar

Joined: Tue Oct 11, 2005 10:46 am
Posts: 1625
If anyone knows how to use this program, we need to make a fraction quiz and the teacher won't tell us anything. So far I just have 3 different numbers with 1 underneath the other two, but if theres a way to make it one character, I'd appreciate the help.


something like:

a + b
- -
c c

I think I'm going to do the math outside the fraction and just check for the correct answer, unless someone can give me a more correct way to do it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 10:52 am 
Tough!
Tough!
User avatar

Joined: Fri Aug 27, 2004 4:05 am
Posts: 929
Location: Texas A&M
so, you need an input (3 numbers: Numerator and Denomenator) and an output (mixed number or decimal)?

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 11:05 am 
Spammer, to the max!
User avatar

Joined: Tue Oct 11, 2005 10:46 am
Posts: 1625
we're supposed to generate 3 random numbers for easy difficulty, and 4 for medium and hard (different bottom numbers, can't think of the word).

fatass teacher wrote:
Quiz phase 3

Expand the current quiz program to include add, subtract, multiply, and divide of fractions. All answers received from the user must be in simplified form. Improper fractions are acceptable. No mixed numbers. Show the fractions as they would see them in a math book.

The easy quiz should be the only one in which like denominators already exist. Medium and hard should have unlike denominators.


Earlier we had to just make two numbers for + - x and /, and now must do fractions. I can generator the 4 random numbers fine, but I'm not sure how to make it so they go together evenly for multply and divide.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 1:01 pm 
Tough!
Tough!
User avatar

Joined: Wed Sep 29, 2004 7:58 am
Posts: 912
Location: {Hand} {Down} {Trousers} {Jerkin} {I'm Playing Solo Right Now}
why not just follow the basic rules for multiply and divide fractions...?
http://www.aaamath.com/fra.html#topic23

Here is the program...
http://www.cplusplus.com/src/fraction2.zip


One thing i learned from college is there is an example of every program on the internet it seems. I just chose to learn from google instead of a 300$ text book.

_________________
"My dreams are all dead & buried. Sometimes I wish the sun would just explode. When God comes and calls me to his kingdom, I'll take all you sonsabitches when I go"


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 3:55 pm 
Spammer, to the max!
User avatar

Joined: Tue Oct 11, 2005 10:46 am
Posts: 1625
Thanks Computer. I'm not very good at finding what I need on the internet if wikipedia doesn't have it :x


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 4:49 pm 
Tough!
Tough!
User avatar

Joined: Fri Aug 27, 2004 4:05 am
Posts: 929
Location: Texas A&M
you basically need to take in 2 fractions in the form of "x / x" and put them into an array of characters.

to add, you find the common denominator by multiplying the smallest denominator by the largest denominator, and the opposite for the larger denominator. you then multiply the numerators of both by the same number as you did w/ the denominator, and add them together, and move that answer to your solution array. subtraction is the same concept.

to multiply, just multiply the 2 numerators and store that into the numerator of the solution, and the same for the denominator. to divide, invert the 2nd fraction and multiply

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 4:32 pm 
Spammer, to the max!
User avatar

Joined: Tue Oct 11, 2005 10:46 am
Posts: 1625
well, the one link you gave me, the program samples it gives have 25+ errors :( and I'm not sure whats all wrong other than it might be a different version. I went to the website and click fractions 1, and that worked, but it only simplified fractions that the user inputed.

in the end, i wasted all day making part of my program look silly, and I guess I'll figure it out monday.


p.s.
thanks for the snow yarr


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 4:55 pm 
Star-Spangled Subligar
Star-Spangled Subligar
User avatar

Joined: Wed Dec 31, 1969 7:00 pm
Posts: 15671
Location: THE DOJO
Armani wrote:
p.s.
thanks for the snow yarr


Marry god damn christmass

_________________
COBRA KAI DOJO NEVER DIES
RIP Shiloh


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 5:43 pm 
The Original Dark Knight™
The Original Dark Knight™
User avatar

Joined: Tue Jun 08, 2004 4:55 pm
Posts: 5060
Location: New York
Marry god? He doesn't like the gays.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 6:16 pm 
The legend. Teh Ponuh™
User avatar

Joined: Thu Oct 07, 2004 6:36 pm
Posts: 7134
Location: I will eat you alive I will eat you alive
Reinheld wrote:
Marry god? He doesn't like the gays.


Bullshit--How do you explain THIS, then?

Image


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 7:27 pm 
Emo Immolator
Emo Immolator
User avatar

Joined: Wed May 26, 2004 10:13 pm
Posts: 2282
Location: Seattle
Ponuh wrote:
Reinheld wrote:
Marry god? He doesn't like the gays.


Bullshit--How do you explain THIS, then?

Image


I always wonder why he keeps that entourage of little boy angels.

_________________
Retired 8/21/06
Don't click this link.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 8:13 pm 
Mike&Ike Irl
Mike&Ike Irl

Joined: Mon Sep 20, 2004 5:59 pm
Posts: 5256
Location: The Internet
that guy couldnt even get a girl... look at that thumbtac cock


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 11:13 pm 
Tough!
Tough!
User avatar

Joined: Wed Sep 29, 2004 7:58 am
Posts: 912
Location: {Hand} {Down} {Trousers} {Jerkin} {I'm Playing Solo Right Now}
How did a C++ thread get hit with a gay stick?

_________________
"My dreams are all dead & buried. Sometimes I wish the sun would just explode. When God comes and calls me to his kingdom, I'll take all you sonsabitches when I go"


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 04, 2007 11:25 am 
Spammer, to the max!
User avatar

Joined: Tue Oct 11, 2005 10:46 am
Posts: 1625
ponuh i think


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 9:22 am 
Spammer, to the max!
User avatar

Joined: Tue Oct 11, 2005 10:46 am
Posts: 1625
we gotta use a command called modulus (%) but the teacher won't tell us how to use it. it makes sure numbers divide into each other evenly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

Board index » Community » Community Discussion


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group