Wrote exactly as seen in a tutorial:
If I enter 1-5 it works fine.
If I enter m,t,w,h or f it will act weird.
If I do it in xcode it will the output is:
Code:
#import <Foundation/Foundation.h>
int main (int argc, const char* argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
enum day {m=1, t, w, h, f};
enum day entry;
NSLog(@"Enter a number of day of the week: ");
scanf("%i", &entry);
NSLog(@"entry = %i", entry);
switch(entry)
{
case m:
NSLog(@"Monday!");
break;
case t:
NSLog(@"Tuesday!");
break;
case w:
NSLog(@"Wednesday!");
break;
case h:
NSLog(@"Thursday!");
break;
case f:
NSLog(@"Friday");
break;
default:
NSLog(@"Wtf, you high?");
break;
}
NSLog(@"done");
[pool drain];
return 0;
}
If I enter 1-5 it works fine.
If I enter m,t,w,h or f it will act weird.
If I do it in xcode it will the output is:
Code:
2011-10-09 06:21:25.916 MyNewProject[860:903] Enter a number of day of the week:
w
2011-10-09 06:25:48.575 MyNewProject[860:903] entry = 0
2011-10-09 06:25:48.580 MyNewProject[860:903] Wtf, you high?
2011-10-09 06:25:48.585 MyNewProject[860:903] done
Program ended with exit code: 0