Thread: help with arrays and loops

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    6

    help with arrays and loops

    im sorry about this repost. i just registered my screen name so i can be certain that i could go bak and modify my question.

    i need help with the for loops to check the winning combinations.
    thank you

    using an array, how can i check if there is a certain number of 'chips' in a row, horizontal or diagonal. i know that there are a bunch a for loops. its cause this is bearly my first programming class and we just went over this like 4 days ago and he just went over regular arrays like a[5] and like 1/2 a class on a[5][5] so im totally lost. it will be totally appreciated. PLEASE help me. i cant get it to work.

    for example:

    a[5][5];

    ( ) ( ) ( ) ( ) ( )
    ( ) ( ) ( ) ( ) ( )
    ( ) ( ) ( ) ( ) ( )
    ( ) ( ) ( ) ( ) ( )
    (o) (o) (o) (o) ( )
    this is a winner

    ( ) ( ) ( ) ( ) ( )
    (o) ( ) ( ) ( ) ( )
    (o) ( ) ( ) ( ) ( )
    (o) ( ) ( ) ( ) ( )
    (o) ( ) ( ) ( ) ( )
    this is a winner

    ( ) ( ) ( ) ( ) ( )
    ( ) ( ) ( ) (o) ( )
    ( ) ( ) (o) ( ) ( )
    ( ) (o) ( ) ( ) ( )
    (o) ( ) ( ) ( ) ( )
    this is a winner

    ( ) ( ) ( ) ( ) ( )
    ( ) (o) ( ) ( ) ( )
    ( ) ( ) (o) ( ) ( )
    ( ) ( ) ( ) (o) ( )
    ( ) ( ) ( ) ( ) (o)
    this is a winner







    ok thanx. i understand the vertical and horizontal loops..but what about the diagonal loops.. thanx
    Last edited by jdiazj1; 11-22-2001 at 02:48 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help using arrays and loops for math
    By LLINE in forum C++ Programming
    Replies: 3
    Last Post: 06-09-2008, 04:09 AM
  2. Too many loops D:
    By F5 Tornado in forum C++ Programming
    Replies: 6
    Last Post: 12-03-2007, 01:18 AM
  3. while loops with arrays
    By volk in forum C Programming
    Replies: 2
    Last Post: 02-04-2003, 07:22 PM
  4. Arrays and loops
    By Zewu in forum C++ Programming
    Replies: 3
    Last Post: 05-25-2002, 11:05 AM
  5. loops and arrays
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 10-03-2001, 03:12 PM