Thread: Need help with tictactoe game(C)

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    16

    Need help with tictactoe game(C)

    I'm not sure what is wrong with it but when i enter cetain coordinates it puts X's on multipul squares.I am pretty new to programming so go easy on me.
    T.c
    tictactoe.h

  2. #2
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    • Your if statements are wrong, you probably meant to use "==".
    • Don't put function bodies in the header file
    • Don't capitalize function names, that's standard for macros.
    • Find a new way to check for winner. Your "if" statements took up eight wrapping lines on a standard 80-character window.
    • You're declaring a global board[3][3] in both files, and they are different variables. Learn how to pass variables, and declare it in main.
    • You aren't error checking. If someone enters 4, it'll go out of bounds and probably crash.
    • You're using flaggy code, and that's poor style.

    Fix these things, and we can help you with the actual issue.

  3. #3
    Registered User
    Join Date
    Dec 2011
    Posts
    16
    Thank you for you answer. I didn't realize that I had a single equals sign in my if statement.

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. i need this for my tictactoe game. pls help.
    By riel in forum C Programming
    Replies: 1
    Last Post: 01-20-2008, 01:31 AM
  3. Help Wit TicTacToe Game
    By WackoWolf in forum C Programming
    Replies: 5
    Last Post: 11-17-2005, 12:20 PM
  4. My TicTacToe game
    By Vicious in forum Game Programming
    Replies: 11
    Last Post: 05-26-2002, 11:02 AM
  5. Replies: 1
    Last Post: 11-06-2001, 02:15 PM