Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////////////
- //* Luis Padron & Pandeli Zi *//
- //* Date: *//
- //* *//
- //* C - Programming *//
- //* *//
- ////////////////////////////////////////////////////////////////////
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #define PAUSE system("pause")
- #define CLS system("cls")
- #define FLUSH fflush(stdin)
- #define ROW 1
- #define COL 4
- char getChoice(); //function to get choice
- void getResults(int r[][COL], int *count);
- ///////////////////////////////MAIN///////////////////////////////////////////
- main()
- {
- char choice;
- int results[ROW][COL] = { 0 }, count = 0;
- do
- {
- choice = getChoice();
- switch (choice)
- {
- case 'A':
- PAUSE;
- break;
- case 'B':
- PAUSE;
- break;
- case 'C':
- break;
- case 'D':
- break;
- case 'E':
- printf("Quitting...\n");
- break;
- default:
- printf("\nNot a valid choice.\n");
- PAUSE;
- break;
- }
- } while (choice != 'E');
- PAUSE;
- } //end main
- char getChoice()
- {
- char result;
- CLS;
- printf("*****************************************************************\n");
- printf("** MAIN MENU **\n");
- printf("*****************************************************************\n");
- 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");
- FLUSH;
- scanf("%c", &result);
- FLUSH;
- return toupper(result);
- }//end getChoice
- void getResults(int r[][COL], int *count)
- {
- int i, j;
- for (i = 0; i < ROW; i++)
- {
- for (j = 0; j < COL; j++)
- {
- printf("Enter result for game %i, did you win? 1. Yes 2. No %i \n", i, j + 1);
- scanf("%i", &r[i][j]);
- }//end inner
- *count = i;
- }//end outer
- }//end load grades
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement