Can someone please help me understand how the function code for the functions listed in the header file above can be coded into such a program such as the one below:
I am not looking for solutions, just an explanation... The reason why I am confused is because the program below was given to us with the program assignment instructions...
Do you guys think I am just suppose to use the program below as a structure suggestion and simply replace each line below with a line of code that I created that completes the same objectives as the lines below suggest, or am i suppose to run the code below at the end, just as it is, and have it work successfully?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include "frameworknew.h"
int main () {
int guess1, guess2, guess3, guess4;
if ((guess1 == 0 > 5) && (guess2 == 0 > 5) && (guess3 == 0 > 5) && (guess4 == 0 > 5));
{
// Stores the real answer and the user's board, respectively.
int answer[NUM_PEGS];
int board[NUM_PEGS];
// Set everything up.
int num_turns = 0;
fillBoard(answer);
greeting();
int start = time(0);
// Loop through each turn, ending at 10 moves or a win.
do {
// Read in the user's guess.
getUserGuess(board);
// Figure out the number of matches.
int num_perfect = numPerfectMatches(board, answer);
int num_imperfect = numWrongPlaceMatches(board, answer);
// Update for this turn.
printf("You have %d perfect matches and %d imperfect matches.\n", num_perfect, num_imperfect);
num_turns++;
} while (num_turns < MAX_TURNS && numPerfectMatches(board, answer) < NUM_PEGS);
// Winning case.
if (numPerfectMatches(board, answer) == NUM_PEGS) {
int end = time(0);
printWinner(num_turns, end-start);
}
// Losing case.
else {
printf("Sorry, you have exceeded the maximum number of turns. You lose.\n");
printf("Here is the winning board: ");
printArray(answer, NUM_PEGS);
printf("\n");
}
}
system ("PAUSE");
return 0;
}