Subscribe ( )

iPhone Programming Tutorials

 

Forum

You must be logged in to post Login Register

Search 

Learning Objective C: Why Doesn’t This Work?

User Post

8:17 pm
October 23, 2008


macsilvr

Noob

posts 1

1

I'm trying to learn Objective C so that I can program for the iPhone. I've been working through Programming In Obective C (Stephan Kochan) and have experimented with making a Point class. However, I can't figure out why this doesn't work if x & y (Point's only instance variables) don't function properly if they are floats, whereas they work fine if they are ints.


Here is the code I wrote mushed into one file (for ease of uploading):


Any help is greatly appreciated!

11:25 am
November 18, 2008


VertigoSol

Moderator

posts 26

2
-(void) toString {
printf(”(%d, %d)”, x, y);
}

%d prints a integer
%f is what you want to print a float


About the iCodeBlog forum

Currently Online:

Skippie

4 Guests

Maximum Online: 25

Forums:

Groups: 2

Forums: 6

Topics: 215

Posts: 618

Members:

There are 435 members

There are 1 guests


Brandon has made 87 posts

Top Posters:

bobcubsfan - 52

crazyiez - 30

VertigoSol - 26

Uhu - 17

AdeC - 17

Administrator: Brandon | Moderators: VertigoSol


© - Version 3.1.4 (Build 357)