Thread: How do i get this program to print random numbers?

  1. #16
    Registered User
    Join Date
    Nov 2017
    Posts
    12
    nah I'm going to remove that part. so now its just like this How do i get this program to print random numbers?-xo-jpg

  2. #17
    Banned
    Join Date
    Aug 2017
    Posts
    861
    Quote Originally Posted by Santac View Post
    nah I'm going to remove that part. so now its just like this How do i get this program to print random numbers?-xo-jpg
    DUDE! why are you taking the easy way out?

  3. #18
    Registered User
    Join Date
    Nov 2017
    Posts
    12
    I have 2 hours to meet a deadline. so I could play around with it and try it out. how easy would it be to make it into a 3D shape? and like a dice?

  4. #19
    Banned
    Join Date
    Aug 2017
    Posts
    861
    you could split the x and o and make it call each one depending on if the user is x or o and the computer is x or o. that should not take too long. just split your array and call it separately .

  5. #20
    Banned
    Join Date
    Aug 2017
    Posts
    861
    in case you give a look again.
    Code:
    char shapeX[7][8] = {      "-------"
                             , "|*   *|"
                             , "| * * |"
                             , "|  t  |"
                             , "| * * |"
                             , "|*   *|" 
                             , "-------"
                            };
    char shapeO[5][6] = { 
                               " *** "
                             , "*   *"
                             , "*   *"
                             , "*   *"
                             , " *** " 
                           };
    
        shapeO[2][2] = numbers[(rand() % 6)];
        
      
        // print the image
        
            for(int k = 0; k < 5; k++)
            {
                for(int c = 0; c < 6; c++)
                    printf("%c", shapeO[k][c]);
                  printf("\n");
            }
           
        
     
        shapeX[3][3] = numbers[(rand() % 6)];
        
            for(int k = 0; k < 7; k++)
            {
                for(int c = 0; c < 8; c++)
                    printf("%c", shapeX[k][c]);
                printf("\n");
            }
    Code:
    $ ./x_and_o_3darray
     *** 
    *   *
    * 3 *
    *   *
     *** 
    -------
    |*   *|
    | * * |
    |  2  |
    | * * |
    |*   *|
    -------

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program to print the numbers in ascending order
    By abhi143 in forum C Programming
    Replies: 5
    Last Post: 10-18-2017, 04:36 AM
  2. program prints random numbers not the sum
    By tlxxxsracer in forum C Programming
    Replies: 5
    Last Post: 11-08-2015, 10:08 PM
  3. Replies: 4
    Last Post: 01-21-2015, 12:14 PM
  4. Replies: 1
    Last Post: 10-30-2011, 10:23 PM
  5. Program to print 3 numbers in ascending order
    By jadedreality in forum C++ Programming
    Replies: 5
    Last Post: 11-08-2007, 07:32 PM

Tags for this Thread