hey im trying to create a connect four game please help.

This is a discussion on hey im trying to create a connect four game please help. within the C Programming forums, part of the General Programming Boards category; Code: #include <stdio.h> #include <math.h> int main(void) { int player1, player2; double count; { printf ("Welcome To Connect Four\n"); } ...

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    9

    hey im trying to create a connect four game please help.

    Code:
    #include <stdio.h>
    #include <math.h>
    
    int main(void)
    
    {
     int player1, player2; 
     double count;
     {
      printf ("Welcome To Connect Four\n");
     }
     count = 0;
     while (count < 6)
     {
      printf ("+---+---+---+---+---+---+---+\n|   |   |   |   |   |   |   |\n");
      count = count + 1;
     }
     printf ("+-1-+-2-+-3-+-4-+-5-+-6-+-7-+\n");
      
     printf ("Enter Name of Player 1:");
     scanf ("%d", &player1);
     printf ("Enter Name of Player 2:");
     scanf ("%d", &player2);
     printf ("Welcome %d and %d.\n"), player1, player2;
    
    }

  2. #2
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,323
    To get you on your way, I'd suggest that you make an array that remembers how many chips are in each row. See if you can print the board for different values
    Fact - Beethoven wrote his first symphony in C

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    2,237
    You:

    - Print heading
    - Print blank game board
    - Receive users' names

    So now what? Have you planned ahead? Planning is very important in programming.

    Perhaps you should consider putting all "game board" "graphics" [characters] in an array instead of hard-printing it like that. Then when something changes, you just modify the array accordingly and print it out again. (This would be a good place for a function, if you've covered that.)

  4. #4
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    Code:
    int player1, player2; 
    ...
    printf ("Enter Name of Player 1:");
    scanf ("%d", &player1);
    printf ("Enter Name of Player 2:");
    scanf ("%d", &player2);
    Names are usually strings not integers. I think "player1" and "player2" should be character arrays.

    Bye, Andreas

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Connect four game help
    By kenneth_888 in forum C++ Programming
    Replies: 2
    Last Post: 05-28-2007, 08:42 AM
  2. New Connect Four Game
    By PJYelton in forum Game Programming
    Replies: 4
    Last Post: 01-17-2003, 09:13 AM
  3. Connect 4 game
    By sundeeptuteja in forum Game Programming
    Replies: 6
    Last Post: 08-12-2002, 11:09 PM
  4. Advanced connect four game
    By Ion Blade in forum C++ Programming
    Replies: 10
    Last Post: 07-28-2002, 07:52 AM
  5. Connect Four game...need help
    By Ion Blade in forum C++ Programming
    Replies: 2
    Last Post: 06-18-2002, 06:18 PM

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