question 1
Quote
Write a function prototype for the following components:
• A function that divides two numbers and returns the
remainder
• A function that finds the larger of two numbers and returns
the result
• A function that prints an ATM menu—it receives no
parameters and returns no value
question 2
Quote
Build the function definitions for each preceding function
prototype.
for the next 2 questions my trivia game is
Quote
#include <stdio.h>
/********************************************
FUNCTION PROTOTYPES
********************************************/
int sportsQuestion(void);
int geographyQuestion(void);
void pause(int);
/*******************************************/
/********************************************
GLOBAL VARIABLE
********************************************/
int giResponse = 0;
/*******************************************/
main()
{
do {
system("clear");
printf("\n\tTHE TRIVIA GAME\n\n");
printf("1\tSports\n");
printf("2\tGeography\n");
printf("3\tQuit\n");
printf("\n\nEnter your selection: ");
scanf("%d", &giResponse);
switch(giResponse) {
case 1:
if (sportsQuestion() == 4)
printf("\nCorrect!\n");
else
printf("\nIncorrect\n");
pause(2);
break;
case 2:
if (geographyQuestion() == 2)
printf("\nCorrect!\n");
else
printf("\nIncorrect\n");
pause(2);
break;
} //end switch
} while ( giResponse != 3 );
} //end main function
/**********************************************************
FUNCTION DEFINITION
**********************************************************/
int sportsQuestion(void)
{
int iAnswer = 0;
system("clear");
printf("\tSports Question\n");
printf("\nWhat University did NFL star Deon Sanders attend? ");
printf("\n\n1\tUniversity of Miami\n");
printf("2\tCalifornia State University\n");
printf("3\tIndiana University\n");
printf("4\tFlorida State University\n");
printf("\nEnter your selection: ");
scanf("%d", &iAnswer);
return iAnswer;
} //end sportsQuestion function
/**********************************************************
FUNCTION DEFINITION
**********************************************************/
int geographyQuestion(void)
{
int iAnswer = 0;
system("clear");
printf("\tGeography Question\n");
printf("\nWhat is the state capitol of Florida? ");
printf("\n\n1\tPensecola\n");
printf("2\tTallahassee\n");
printf("3\tJacksonville\n");
printf("4\tMiami\n");
printf("\nEnter your selection: ");
scanf("%d", &iAnswer);
return iAnswer;
} //end geographyQuestion function
/***********************************************************
FUNCTION DEFINITION
************************************************************/
void pause(int inNum)
{
int iCurrentTime = 0;
int iElapsedTime = 0;
iCurrentTime = time(NULL);
do {
iElapsedTime = time(NULL);
} while ( (iElapsedTime - iCurrentTime) < inNum );
} // end pause function
question 3
Quote
Add your own trivia categories to the Trivia game.
question 4
Quote
Modify the Trivia game to track the number of times a user gets
an answer correct and incorrect. When the user quits the
program, display the number of correct and incorrect answers.
Consider using global variables to track the number of
questions answered, the number answered correctly, and the
number answered incorrectly.