Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Boeing747

macrumors member
Original poster
Jul 10, 2011
57
0
In Steve Job's Closet
Hello everyone,

I'm trying to make a mac application that asks you what your name & age is then tells you the lowest aged person you can date.

Here's my code:
Code:
int main (int argc, const char * argv[]){
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    int dateAge;
    NSString *name;
    
    
    NSLog(@"What is your name?");
    scanf("%@", &name);
    NSLog(@"How old are you?");
    scanf("%i", &dateAge);
    
    NSLog(@"Ok, %@ you can date people that are %i years old or older.",name,dateAge/2+7);
    
    

    [pool drain];
    return 0;
     }
Is there something I should be using instead of scanf for NSStrings?

Thank you.
 
Last edited by a moderator:
How do I do that?

I'm a noob at programming.

What have you tried? What documentation have you read to try and answer your question? What are you using to learn plain, basic C (since that's where scanf and char buffers come from)?

If you are just expecting code provided then you're probably in the wrong place.
 
What have you tried? What documentation have you read to try and answer your question? What are you using to learn plain, basic C (since that's where scanf and char buffers come from)?

If you are just expecting code provided then you're probably in the wrong place.

thenewboston on youtube

I'm trying to expand and do other things other than just trying to do what he does. I'm on lesson 26.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.