Can anyone take a crack at this for me?
I'm trying to do some homework involving custom libraries and such, which surprisingly seems to have turned out alright. The main body of my program is giving me trouble though:
Code:
/*
Assignment 4 [Source]- Random Number Game
*/
/*============================================================================================================*/
#include <stdio.h>
#include <stdlib.h>
#include "game.h"
/*Define variables.*/
int z;
int v = 0;
int r = 0;
char go; error
/*============================================================================================================*/
int main (void)
{
/*================================================*/
/*Function 1- Display header.*/
print_head(); /*Call header function from game.h*/
/*================================================*/
/*Function 2- Generate number and read guess.*/
while(v == 0)
{ /*Start the game.*/
z = 1 + rand() %1000; /*Generate random number between 1 and 1000.*/
/*Read guess from the user and assign to v.*/
printf("I have a number between 1 and 1000.\n Can you guess my number?\n Please type your first guess:");
v = 10001; /*Force start block to end loop.*/
} /*Close start of game.*/
while(v != 0)
{ /*Open the game's main body.*/
scanf("%i", &v); /*Read the user's guess and store at v.*/
/*================================================*/
/*Function 3- Call CONT from game.h*/
CONT();
/*================================================*/
/*Function 4- Call GES from game.h IF the guess is incorrect.*/
if(v != z)
{
GES();
}
/*================================================*/
/*Function 5- Ask the user to restart the game or end the program.*/
if(v == z) /*Open restart block.*/
{
printf("Would you like to play again?(y/n):");
scanf("%c", &go);
if(go == y || go == Y) /*Use input "Yes" to re-enter the start of the game.*/ error
{
v = 0;
}
} /*Close restart block.*/
/*================================================*/
} /*Close the game's main body.*/
/*================================================*/
return 0;
} /*Close the main function.*/
/*============================================================================================================*/
I marked what the debug told me. Can anyone help?