Thread: Help Wit TicTacToe Game

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    56

    Help Wit TicTacToe Game

    Could someone please help me get pass the build errors/

    I am sending my code

    this is written useing .net 2003

    Thank You
    WackoWolf
    Code:
    // This is the main project file for VC++ application project 
    // generated using an Application Wizard.
    
    #include "stdafx.h"
    #include <assert.h>
    
    #using <mscorlib.dll>
    
    using namespace System;
    
    void welcome(void);
    enum Turn who_goes_first(void);
    void gameover_message(enum Result result);
    int play_again(void);
    void goodbye(void);
    
    int _tmain()
    {
    	enum Turn turn;
    	enum Result result;
    	int newgame = 1;
    
    	welcome();
    
    	while (newgame)  {
    		turn = who_goes_first();
    		result = play_game(turn);
    		gameover_message(result);
    	newgame = play_again();
    	};
    
    	goodbye();
    	return 0;
    
        
    }
    
    void welcom(void)
    // This is The Welcome Screen, which also has the rules
    
    {
    	printf("Welcome To Tic-Tac-Toe\n\n");
    	printf("----------------------\n\n");
    	printf("The Object of this game is to get a line of X's\n);
    	printf("before the other person gets a line of O's. A line may\n");
    	printf("be across, down, or diagonal.\n\n");
    	printf("The board is labelled from 1 to 9 as follows:\n\n");
    	printf("\t1|2|3\n");
    	printf("\t-----\n");
            printf("\t4|5|6\n");
            printf("\t-----\n");
            printf("\t7|8|9\n");
    	printf("\n\n");
    }
    enum Turn who_goes_first(void)
    {
    	int decide = getint_from_user1("Do you wish to go first (1-Yes, 0-N0) ? ");
    	if (decide == 1)
    		return USER1;
    	// If user types anything but "1", user 2 goes first
    	return USER2;
    }
    void gameover_message(enum Result result)
    
    {
    	switch(result)
    	{
    	case WIN:
    		printf("\nYou Win.\n\n");
    		break;
    	case LOSE:
    		printf("\nYou Lose.\n\n");
    		break;
    	case DRAW:
    		printf("\nIts a Draw.\n\n");
    		break;
    	default:
    		assert(0);
    	}
    }
    
    	void goodbye(void)
    		// Goodbye Message
    	{
    		printf("\nGoodbye.\n\n");
    	}

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Without a list of your errors or all of your code, including that library and that DLL, there isn't much I can do. I'm pretty sure people don't want to blindly search through your program guessing on what the errors are cause we don't know if you did this over here or that over there.
    Sent from my iPadŽ

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    56
    The libary is something that Microsoft put in, I rem it out. I am going to pase the errors in this mesg. If you could help it would be nice

    [code]
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(79): warning C4065: switch statement contains 'default' but no 'case' labels
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(27): error C3861: 'play_game': identifier not found, even with argument-dependent lookup
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(44): error C2001: newline in constant
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(45): error C2146: syntax error : missing ')' before identifier 'printf'
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(57): error C3861: 'getint_from_user1': identifier not found, even with argument-dependent lookup
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(59): error C2065: 'USER1' : undeclared identifier
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(61): error C2065: 'USER2' : undeclared identifier
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(68): error C2065: 'WIN' : undeclared identifier
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(68): error C2051: case expression not constant
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(71): error C2065: 'LOSE' : undeclared identifier
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(71): error C2051: case expression not constant
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(74): error C2065: 'DRAW' : undeclared identifier
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(74): error C2051: case expression not constant
    [\code]

  4. #4
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Alright I'll keep updating this error at a time, so let's kick it off:

    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(44): error C2001: newline in constant
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(45): error C2146: syntax error : missing ')' before identifier 'printf'
    You're missing an end quote on line 44.

    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(27): error C3861: 'play_game': identifier not found, even with argument-dependent lookup
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(57): error C3861: 'getint_from_user1': identifier not found, even with argument-dependent lookup
    Neither of these are prototyped in your program.

    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(59): error C2065: 'USER1' : undeclared identifier
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(61): error C2065: 'USER2' : undeclared identifier
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(68): error C2065: 'WIN' : undeclared identifier
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(71): error C2065: 'LOSE' : undeclared identifier
    c:\Documents and Settings\Wacko\My Documents\Visual Studio Projects\Ttt\TTT.cpp(74): error C2065: 'DRAW' : undeclared identifier
    None of these are declared. Make your enums for them.
    Last edited by SlyMaelstrom; 11-17-2005 at 11:08 AM.
    Sent from my iPadŽ

  5. #5
    Registered User
    Join Date
    Oct 2004
    Posts
    56
    Ok I got Line 44 taken care of.

  6. #6
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    The rest of the errors are because your enums are not defined, nor are some of your functions.
    Sent from my iPadŽ

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. i need this for my tictactoe game. pls help.
    By riel in forum C Programming
    Replies: 9
    Last Post: 01-21-2008, 05:10 AM
  2. C Programming 2d Array Question
    By jeev2005 in forum C Programming
    Replies: 3
    Last Post: 04-26-2006, 03:18 PM
  3. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM
  5. Replies: 1
    Last Post: 11-06-2001, 02:15 PM