I'm learning still. I stripped this code out of a slightly larger one to find the problem. It seems so simple and yet I can't solve it. I have 3 'scanf' after 3 NSLog questions. The problem that I am having is that it skips over the second scanf and jumps right to the last one with no input from the user?
Here is the code.
Help me ob one.
-Lars
Here is the code.
Code:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
float tb, tb2;
char oper;
NSLog(@"Enter the first number:");
scanf("%f",&tb);
NSLog(@"Enter + or -");
scanf("%c",&oper);
NSLog(@"Enter the second number:");
scanf("%f",&tb2);
[pool drain];
return 0;
}
Help me ob one.
-Lars