| Author | 
		Message | 
	
		 
		nigana
 
 
 
    
		 | 
		
		
			
				  Posted: Mon May 11, 2009 12:04 pm    Post subject: please help!~  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				can someone help me with this questions, i am really confused.
 
 
 
 
5.Write a program that inputs two fractions in the form a/b and c/d, and outputs their sum in the form p / q cancelled down to its simplest form. This should continue until the user types in an exit command of your choice.
 
 
Sample run:	Input: 5/6 1/10 
 
Output: 14/15 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	
	 
		  | 
	
				 
		Tony
 
  
 
    
		 | 
		
		 | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		BigBear
 
 
 
    
		 | 
		
		
			
				  Posted: Mon May 11, 2009 2:05 pm    Post subject: RE:please help!~  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				You need to get two different fractions with different bases and output their sum so make the denominator the same then add the numerator
 
 
Post some code or a specific part you are having trouble with | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		nigana
 
 
 
    
		 | 
		
		
			
				  Posted: Tue May 12, 2009 9:52 am    Post subject: RE:please help!~  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				var num1,dem1,num2,dem2:int
 
loop
 
put "please enter the number of the first fraction:  "..
 
get num1
 
put "please enter the denominator of the first fraction:  "..
 
get dem1
 
put "please enter the number of the second fraction:  "..
 
get num2
 
put "please enter the number of the second fraction:  "..
 
get dem2
 
 
if dem1 not=dem2 then
 
var dem:int:=dem1*dem2
 
var num3:int:=dem2*num1
 
var num4:int:=num2*dem1
 
put num3+num4,"/",dem
 
elsif dem1=dem2 then
 
var num5:int:=num1+num2
 
put num5,"/",dem1
 
end if 
 
end loop
 
 
how do we simply the answer can you give us the code plz!! | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		jernst
 
  
 
    
		 | 
		
		
			
				  Posted: Tue May 12, 2009 10:00 am    Post subject: Re: please help!~  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| ....way to post this same thing in three places..that will get you lots of help. | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		BigBear
 
 
 
    
		 | 
		
		
			
				  Posted: Tue May 12, 2009 1:58 pm    Post subject: RE:please help!~  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				You won't be given the code
 
 
Also try not to declare variables in loop the computer will keep making new variables with the same name and not be able to access the previous one so just declare before the loop and change the value inside the loop
 
 
also use [syntax="turing"]%code[/syntax ] | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		 |