Convert all test programs from CPP to C
[gruntmaster-daemon.git] / t / problems / increment / ver.c
diff --git a/t/problems/increment/ver.c b/t/problems/increment/ver.c
new file mode 100644 (file)
index 0000000..bdd5820
--- /dev/null
@@ -0,0 +1,23 @@
+#include<stdio.h>
+#include<stdlib.h>
+#include<time.h>
+#include<unistd.h>
+
+int main(void){
+       srand(time(NULL));
+       for(int i=0;i<100;i++){
+               int nr = rand() % 100;
+               printf("%d\n", nr);
+               fflush(stdout);
+               int ret;
+               scanf("%d", &ret);
+               if(ret != nr + 1){
+                       fprintf(stderr, "bad ret: %d instead of %d", ret, nr + 1);
+                       return 1;
+               }
+       }
+
+       if(write(4, "20", 2) == -1)
+               perror("write");
+       return 0;
+}
This page took 0.010184 seconds and 4 git commands to generate.