fork download
  1. // Connor Harkins
  2. // 3/26/2017
  3. // CS 102-03
  4. #include <time.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7.  
  8. //This program will allow two players to play a game of Fifty
  9.  
  10. int main(void)
  11. {
  12. int turn = 1;
  13. int p1Score = 0;
  14. int p2Score = 0;
  15. srand(time(NULL));
  16. int d1 = (rand() % 6) + 1;
  17. int d2 = (rand() % 6) + 1;
  18.  
  19. while (p1Score <= 50 && p2Score <= 50){
  20. printf("%d\n", p1Score);
  21. if(d1 == d2){
  22. if(d1 == 3){
  23. if(turn == 1) {
  24. p1Score = 0;
  25. turn = 2;
  26. }
  27. if(turn == 2) {
  28. p2Score = 0;
  29. turn = 1;
  30. }
  31. }
  32. if(d1 == 6){
  33. if(turn == 1) {
  34. p1Score = p1Score +25;
  35. turn = 2;
  36. }
  37. if(turn == 2) {
  38. p2Score = p2Score + 25;
  39. turn = 1;
  40. }
  41. }
  42. else{
  43. if(turn == 1){
  44. p1Score = p1Score + 5;
  45. turn = 2;
  46. }
  47. if(turn == 2){
  48. p2Score = p2Score + 5;
  49. turn = 1;
  50. }
  51. }
  52. d1 = (rand() % 6) + 1;
  53. d2 = (rand() % 6) + 1;
  54. }
  55. return 0;
  56. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:56:1: error: expected declaration or statement at end of input
 }
 ^
stdout
Standard output is empty