Skip to content

Instantly share code, notes, and snippets.

@algorev
Created December 23, 2016 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save algorev/0dbea29d9cc9f0e0a7925b928871e36b to your computer and use it in GitHub Desktop.
Save algorev/0dbea29d9cc9f0e0a7925b928871e36b to your computer and use it in GitHub Desktop.
#include "varcode.h"
int main()
{
int timetick = 0;
int result = 0;
char command[3] = {'o','\0'};
printf("VarCode v1.0, by Spooikypok_Dev");
while(command[0] != 'e')
{
printf("\n>");
fgets(command,3,stdin);
command[2] = '\0';
switch(command[0])
{
case 'i':
result++;
break;
case 'd':
result--;
break;
case 's':
result *= result;
break;
case 'o':
printf("%d", result);
break;
case 'e':
break;
case 'z':
result = 0;
break;
case 'p':
timetick = time(NULL);
while(time(NULL) < timetick + 1);
break;
case '\n':
break;
default:
printf("invalid command: %c", command[0]);
break;
}
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment