fork(1) download
  1. #import <Foundation/Foundation.h>
  2.  
  3. int main(int argc, const char * argv[]) {
  4.  
  5. // insert code here...
  6. int month;
  7. char*mth;
  8. NSLog(@"Please enter the month: ");
  9. scanf("%i", &month);
  10.  
  11. if(month = 1,3,5,7,8,10,12) month = "January";
  12. else mth = 'invalid';
  13.  
  14. switch(mth) {
  15. case 'January': mth =1;
  16. case 'April': mth =4;
  17. case 'May': mth =5;
  18. case 'July': mth =7;
  19. case 'Aug': mth =8;
  20. case 'Oct'': mth =10;
  21. case 'Dec': mth =12;
  22. NSLog(@"There are 31 days in that %i.\n", month);
  23. break;
  24. case 2:
  25. NSLog(@"There are 28 days in that %c.\n", mth);
  26. break;
  27. case 4:
  28. case 6:
  29. case 9:
  30. case 11:
  31. NSLog(@"There are 30 days in that %c.\n", mth);
  32. break;
  33. default:
  34. NSLog(@"Invalid month.\n");
  35. }
  36. return 0;
  37. }
Compilation error #stdin compilation error #stdout 0.02s 10872KB
stdin
1
compilation info
prog.m: In function 'main':
prog.m:11:35: warning: assignment makes integer from pointer without a cast [enabled by default]
prog.m:12:12: warning: character constant too long for its type [enabled by default]
prog.m:12:10: warning: assignment makes pointer from integer without a cast [enabled by default]
prog.m:14:8: error: switch quantity not an integer
prog.m:15:6: warning: character constant too long for its type [enabled by default]
prog.m:15:21: warning: assignment makes pointer from integer without a cast [enabled by default]
prog.m:16:6: warning: character constant too long for its type [enabled by default]
prog.m:16:19: warning: assignment makes pointer from integer without a cast [enabled by default]
prog.m:17:6: warning: multi-character character constant [-Wmultichar]
prog.m:17:17: warning: assignment makes pointer from integer without a cast [enabled by default]
prog.m:18:6: warning: multi-character character constant [-Wmultichar]
prog.m:18:18: warning: assignment makes pointer from integer without a cast [enabled by default]
prog.m:19:6: warning: multi-character character constant [-Wmultichar]
prog.m:19:17: warning: assignment makes pointer from integer without a cast [enabled by default]
prog.m:20:6: warning: multi-character character constant [-Wmultichar]
prog.m:20:11: warning: missing terminating ' character [enabled by default]
prog.m:20:1: error: missing terminating ' character
prog.m:21:1: error: expected ':' or '...' before 'case'
prog.m:21:6: warning: multi-character character constant [-Wmultichar]
prog.m:21:17: warning: assignment makes pointer from integer without a cast [enabled by default]
stdout
Standard output is empty