Amazon.com Widgets No Responce...
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2013, 07:53:20 PM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Old Stuff
| |-+  Help!!!
| | |-+  No Responce...
Pages: [1]   Go Down
Print
Author Topic: No Responce...  (Read 475 times)
kaha
Newbie
*
Posts: 8






« on: June 07, 2009, 11:12:29 AM »

Ch. 7 Program 7.4 Test File FractionTest.m
(warning Fraction may not respond to '-add:')
(................'-reduce:')

#import "Fraction.h"

int main (int argc, char *argv[])
{
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
   
   Fraction *aFraction = [[Fraction alloc] init];
   Fraction *bFraction = [[Fraction alloc] init];
   
   [aFraction setTo: 1 over: 4];   // set 1st fraction to 1/4
   [bFraction setTo: 1 over: 2];   // set 2nd fraction to 1/2
   
   [aFraction print];
   NSLog (@"+");
   [bFraction print];
   NSLog (@"=");
   
   [aFraction add: bFraction];
   
   // reduce the result of the addition and print the result
   
   [aFraction reduce];
   [aFraction print];
   
   [aFraction release];
   [bFraction release];
   
   [pool drain];
   return 0;
}




// again, thanks for any help!
« Last Edit: June 09, 2009, 10:20:18 PM by kaha » Logged
esc
Global Moderator
Full Member
*****
Posts: 230






« Reply #1 on: June 07, 2009, 04:51:23 PM »

Looks like you are missing a "%" in this statement:

scanf ("lf %c %lf", &value1, &operator, &value2);

Should be:
scanf ("%lf %c %lf", ...);

If you are still running into problem, please tell us your input values and what the program/debugger tells you.

Cheers!
Logged
kaha
Newbie
*
Posts: 8






« Reply #2 on: June 07, 2009, 08:37:24 PM »

thats works... thank you!
Logged
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.