I am following a code example in "Programming in Objective-c"
here is the code example:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int n, number, triangularNumber;
NSLog(@"What triangular number do you want?");
scanf("%i", &number);
triangularNumber = 0;
for( n = 1; n <= number; ++n)
{
triangularNumber += n;
}
NSLog(@"Triangular number %i is %i\n", number, triangularNumber);
[pool drain];
return 0;
}
The issue is that it just goes straight through the entire program without waiting for user input. I've tried tricking with conditional statements but it just seems to not want to get any user input.
I've crawled the web for about day on this, so if anyone has had a similar experience, please let me know. Im Using X-code and obj-c, im fairly new to it. But Ive been doing C/C++ for a little more then 3 years just to give a little background on my C knowledge.
Appreciate the help in advance
~Syn
This post has been edited by Synerate: 18 August 2011 - 09:48 AM

New Topic/Question
Reply



MultiQuote




|