fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main(void) {
  4.  
  5. #define BASE 40 //base crit percentage
  6. #define ITERATIONS 10000
  7. cout<< The result is <<c
  8. int cnt = 0, inc=10;
  9. double pct = 0.0;
  10. srand(time(NULL));
  11.  
  12. for (int i = 0; i < ITERATIONS; i++)
  13. {
  14. if (rand()%100 < (BASE + inc))
  15. {
  16. cnt++;
  17. inc = 0;
  18. }
  19. else
  20. inc+=10;
  21.  
  22. }
  23. pct = (double)cnt/10000;
  24. printf ("Percetage of crit: %lf percent, base was: %d percent\n", pct*100, BASE);
  25.  
  26.  
  27.  
  28.  
  29. return 0;
  30. }
  31.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:7:1: error: ‘cout’ undeclared (first use in this function)
 cout<< The result is <<c
 ^~~~
prog.c:7:1: note: each undeclared identifier is reported only once for each function it appears in
prog.c:7:8: error: ‘The’ undeclared (first use in this function)
 cout<< The result is <<c
        ^~~
prog.c:7:11: error: expected ‘;’ before ‘result’
 cout<< The result is <<c
           ^~~~~~~
           ;
prog.c:10:7: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration]
 srand(time(NULL));
       ^~~~
prog.c:14:27: error: ‘inc’ undeclared (first use in this function); did you mean ‘int’?
  if (rand()%100 < (BASE + inc))
                           ^~~
                           int
prog.c:16:3: error: ‘cnt’ undeclared (first use in this function); did you mean ‘int’?
   cnt++;
   ^~~
   int
stdout
Standard output is empty