I just talked to the teacher and when confronted he said, he never mentioned it because everyone is assumed to have windows which automatically returns 0
This has happened before the teacher posted the following program used from an example
Code:
#include <stdio.h>
#include <time.h>
#include <system.h>
/********************************************
FUNCTION PROTOTYPES
********************************************/
int sportsQuestion(void);
int geographyQuestion(void);
void pause(int);
/*******************************************/
/********************************************
GLOBAL VARIABLE
********************************************/
int giResponse = 0;
/*******************************************/
main()
{
do {
clrscr();
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;
clrscr();
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;
clrscr();
printf("\tGeography Question\n");
printf("\nWhat is the state capital of Florida? ");
printf("\n\n1\tPensacola\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
The problem with this is the compiler they recommend accept non-ANSI functions like clrscr, however since Miracle C does not run on my Operating System I had to use Dev C++ "which I am glad I did" because I found out clrscr does not run on Dev C++ because it is a Borland Expression from conio.h which is not standard ANSI. I posed this to him and he had no solution except to force the compiler to use it with voids. I looked it up and found out the standard ANSI for something like that is
I do so much research because I do not put much stock in what the teacher says. Some they say is good but they like teaching non-portable ways and do not even mention portable options.