fork download
  1. /* <-- Deadfish Interpreted Computer Language --> */
  2. /* <-- Programmed by Jonathan Todd Skinner --> */
  3.  
  4. /* <-- Include Header File --> */
  5. /* Updated the Code to Remove Uneeded Header Includes - JTS */
  6. #include <stdio.h>
  7.  
  8. /* <-- Declare some variables --> */
  9. unsigned int x; /* make a positive integer and call it x */
  10. char usrinput; /* string to hold user input */
  11.  
  12. /* <-- Declare a function --> */
  13. void entercommand(void);
  14.  
  15. /* <-- Start Main Function --> */
  16. int main(void)
  17. {
  18. /* At beginning of x is always 0 */
  19. x = 0;
  20. entercommand();
  21. }
  22.  
  23. /* <-- Enter Command --> */
  24. void entercommand(void)
  25. {
  26. /* Accept User Input */
  27. printf(">> "); /* output shell symbol */
  28. scanf("%c",&usrinput); /* scan for user input that is char */
  29. /* Check for commands and do action */
  30. /* Make sure x is not greater then 256 */
  31. if(x == 256) x = 0;
  32. if(x == -1) x = 0;
  33. if(usrinput == 'i')
  34. {
  35. x++;
  36. entercommand();
  37. }
  38. else if(usrinput == 'd')
  39. {
  40. x--;
  41. entercommand();
  42. }
  43. else if(usrinput == 'o')
  44. {
  45. printf("%d\n",x);
  46. entercommand();
  47. }
  48. else if(usrinput == 's')
  49. {
  50. x=x*x;
  51. entercommand();
  52. }
  53. else
  54. {
  55. printf("\n");
  56. entercommand();
  57. }
  58.  
  59. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:6: error: illegal character: '#'
#include <stdio.h>
^
Main.java:6: error: class, interface, or enum expected
#include <stdio.h>
         ^
Main.java:10: error: class, interface, or enum expected
char usrinput; /* string to hold user input */
^
Main.java:13: error: class, interface, or enum expected
void entercommand(void);
^
Main.java:16: error: class, interface, or enum expected
int main(void)
^
Main.java:20: error: class, interface, or enum expected
	entercommand();
	^
Main.java:21: error: class, interface, or enum expected
}
^
Main.java:28: error: class, interface, or enum expected
	scanf("%c",&usrinput); /* scan for user input that is char */
	^
Main.java:31: error: class, interface, or enum expected
	if(x == 256) x = 0;
	^
Main.java:32: error: class, interface, or enum expected
	if(x == -1) x = 0;
	^
Main.java:33: error: class, interface, or enum expected
	if(usrinput == 'i')
	^
Main.java:36: error: class, interface, or enum expected
		entercommand();
		^
Main.java:37: error: class, interface, or enum expected
	}		
	^
Main.java:41: error: class, interface, or enum expected
		entercommand();
		^
Main.java:42: error: class, interface, or enum expected
	}
	^
Main.java:46: error: class, interface, or enum expected
		entercommand();
		^
Main.java:47: error: class, interface, or enum expected
	}
	^
Main.java:51: error: class, interface, or enum expected
		entercommand();
		^
Main.java:52: error: class, interface, or enum expected
	}
	^
Main.java:56: error: class, interface, or enum expected
		entercommand();
		^
Main.java:57: error: class, interface, or enum expected
	}
	^
21 errors
stdout
Standard output is empty