tic tac toe (arggg, I really need help!)

This is a discussion on tic tac toe (arggg, I really need help!) within the Game Programming forums, part of the General Programming Boards category; Ok, im trying to just write a simple program to make a tic tac toe game. Ok, I think i ...

  1. #1
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753

    tic tac toe (arggg, I really need help!)

    Ok, im trying to just write a simple program to make a tic tac toe game. Ok, I think i need to use arrays and the like. I'm totally confused on how to start, all i have is a big mess. Here is what I have so far, and there are tons of errors:

    #include <iostream.h>
    #include <conio.h>
    #include <windows.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <math.h>
    #include <iomanip.h>
    #include <string>
    #include <fstream.h>

    int main() //Line 10
    {
    char marker[10];
    int array[3][3];
    int array1[10];
    int move1[10];
    int move2[10];

    cout<<"1 2 3"<<endl;
    cout<<"4 5 6"<<endl;
    cout<<"7 8 9"<<endl;

    int *ptr1;
    int *ptr2;

    int x=1;
    do
    {
    ptr1=move1[x];
    ptr2=move2[x];
    cout<<"Where do you want to move? "; //Line 20
    cin>>move[x];
    cin>>move2[x];
    array[ptr1][ptr2]=marker[x];
    x=x+1;
    }while(x<10);
    }
    return 0;
    }


    Alright, will someone please tell me if im even close to the right kind of idea? Also, since i know im wrong, how would i go about doing a tic tac toe game? ANY HELP WILL HELP ME!!!

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    411
    In such a simple program you shouldnt even worry about pointers.

    You dont need all those headers.
    iostream is the only one you are useing.

    And use x++; instead of x=x+1;

    But all in all you look like you are on the right track.

  3. #3
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    Your probably best storing the board in
    a 2D array

    char board[3][3];

    You can then write some short functions to draw
    the board, check for winer, make a move etc.

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    104
    Here is an example of Tic Tac Toe game:
    http://www.cpp-home.com/code.php?10_1
    Ilia Yordanov,
    http://www.cpp-home.com ; C++ Resources

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help me with my simple Tic tac toe prog
    By maybnxtseasn in forum C Programming
    Replies: 2
    Last Post: 04-04-2009, 06:25 PM
  2. tic tac toe crashes :(
    By stien in forum Game Programming
    Replies: 4
    Last Post: 05-13-2007, 06:25 PM
  3. tic tac toe
    By holden in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 05-09-2004, 09:59 AM
  4. Help with Tic Tac Toe game
    By snef73 in forum C++ Programming
    Replies: 1
    Last Post: 04-25-2003, 08:33 AM
  5. tic tac toe (arggg, I really need help!)
    By Leeman_s in forum C++ Programming
    Replies: 1
    Last Post: 10-11-2001, 12:10 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21