Advertisement
Guest User

Untitled

a guest
Jan 31st, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////
  2. //* Luis Padron & Pandeli Zi *//
  3. //* Date: *//
  4. //* *//
  5. //* C - Programming *//
  6. //* *//
  7. ////////////////////////////////////////////////////////////////////
  8.  
  9. #define _CRT_SECURE_NO_WARNINGS
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <ctype.h>
  13. #define PAUSE system("pause")
  14. #define CLS system("cls")
  15. #define FLUSH fflush(stdin)
  16. #define ROW 1
  17. #define COL 4
  18.  
  19. char getChoice(); //function to get choice
  20. void getResults(int r[][COL], int *count);
  21.  
  22.  
  23. ///////////////////////////////MAIN///////////////////////////////////////////
  24. main()
  25. {
  26. char choice;
  27. int results[ROW][COL] = { 0 }, count = 0;
  28.  
  29.  
  30. do
  31. {
  32. choice = getChoice();
  33.  
  34. switch (choice)
  35. {
  36. case 'A':
  37.  
  38. PAUSE;
  39. break;
  40.  
  41. case 'B':
  42. PAUSE;
  43. break;
  44.  
  45. case 'C':
  46. break;
  47.  
  48. case 'D':
  49. break;
  50.  
  51. case 'E':
  52. printf("Quitting...\n");
  53. break;
  54. default:
  55. printf("\nNot a valid choice.\n");
  56. PAUSE;
  57. break;
  58.  
  59. }
  60.  
  61. } while (choice != 'E');
  62.  
  63. PAUSE;
  64.  
  65.  
  66.  
  67.  
  68.  
  69. } //end main
  70.  
  71. char getChoice()
  72. {
  73. char result;
  74. CLS;
  75. printf("*****************************************************************\n");
  76. printf("** MAIN MENU **\n");
  77. printf("*****************************************************************\n");
  78. printf("\n\tA) Enter game results\n\tB) Current Record\n\tC) Display ALL results of all games WON\n\tD) Display ALL results\n\tE) Quit\n\t");
  79. FLUSH;
  80. scanf("%c", &result);
  81. FLUSH;
  82. return toupper(result);
  83. }//end getChoice
  84.  
  85. void getResults(int r[][COL], int *count)
  86. {
  87. int i, j;
  88.  
  89. for (i = 0; i < ROW; i++)
  90. {
  91. for (j = 0; j < COL; j++)
  92. {
  93. printf("Enter result for game %i, did you win? 1. Yes 2. No %i \n", i, j + 1);
  94. scanf("%i", &r[i][j]);
  95. }//end inner
  96. *count = i;
  97. }//end outer
  98. }//end load grades
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement