DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2006
    Posts
    4

    Game of life help

    i have this assignment due monday, and i dont have any clue where to go next. im sure most of you are aware of the game of life. anyways i need to build it in C++ instead of the usual java. i am trying to make it with the multidimensional arrays, and i am getting lost. i am not sure where to ut teh rules, and i have given up on the randomization part of it. If you could give me any help or tips that would be great. either post or email it to me charesty@norwich.edu thanks--


    //Life Project

    #include <iostream>
    #include <stdlib.h>
    #include <cmath>
    #include <cstdlib>
    using namespace std;



    int x, y, spots;
    int life_spots [22][80];
    void end();
    void fill();
    const int N = 21;
    const int O = 79;
    string answer;
    int s, r, n, o;

    int
    main ()
    {
    life_spots[s][r] = 0;
    for (s = 0; s < 80; s++ )
    {
    for (r = 0; r < 22; r++ )
    {

    }
    }

    fill ();
    }

    void fill ()
    {

    cout << "How many spots in the 22X80 Graph would you to populate?";
    cin >> spots;

    for (n=0; n < spots; n++)
    {
    cout << "Please enter the X coordinate followed by the Y Coordinate,";
    cout << "\n";
    cout << "with a space in between the two values:";
    cin >> x >> y;
    if (y > 80)
    {
    cout << "Error, number must be less than or equal to 80 for Y\n";
    break;
    }
    if (x > 22)
    {
    cout << "Error, number must be less than or equal to 22 for X\n";
    break;
    }

    }

    system("pause");
    end();
    }




    void
    end()
    {
    cout << "Would you like to start over?\n";
    cin >> answer;
    if (answer == "yes")
    {
    main();
    }
    }
    Last edited by kyle_charest; 02-13-2006 at 07:51 AM.

Similar Threads

  1. Game Help (Game to be made in VB)
    By aamsaf in forum VB Classic
    Replies: 0
    Last Post: 09-14-2005, 02:19 PM
  2. Replies: 3
    Last Post: 03-08-2005, 11:24 PM
  3. Replies: 0
    Last Post: 03-07-2002, 03:53 AM
  4. Framework of a complex game...
    By AGuy in forum Java
    Replies: 0
    Last Post: 07-31-2000, 07:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links