Rename t/problems/increment/int.cpp to ver.cpp
[gruntmaster-daemon.git] / t / problems / increment / ver.cpp
diff --git a/t/problems/increment/ver.cpp b/t/problems/increment/ver.cpp
new file mode 100644 (file)
index 0000000..3b89262
--- /dev/null
@@ -0,0 +1,23 @@
+#include<cstdio>
+#include<cstdlib>
+#include<ctime>
+#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.009636 seconds and 4 git commands to generate.