Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

C++ Help with the Game of Life (John Conway) Assignment

I really need help on finishing this assignment. I really do not know how to finish it. I do know I need to the use the rules of the "Game of Life" and compare each character in the array.

[b]Here is the assignment: [/b][link=http://pastebin.com/2kW5DrWe]http://pastebin.com/2kW5DrWe[/link]

The code asks the user to input a filename (ie life01.txt)

[b]life01.txt: [/b][link=http://pastebin.com/ZqgrEbKi]http://pastebin.com/ZqgrEbKi[/link]

[b]The program is uploaded to: [/b][link=http://www.hypergrade.com]http://www.hypergrade.com[/link]

Also I use [b]DEV-C++[/b]
[b]what do I do?[/b]

[code]//Game of Life
//Dylan

#include
#include
#include
#include

using namespace std;

//functions
void GetFile(); //Get filename
char MakeArray(); //Make 2d array
char ChgArray(); //change the array
char GameBoard(); //Game Board


//Global Variables
const int ROW1 =12;
const int COL1 =30;
ifstream myfile;
string filename;
char live = 'x'; //life cells
char dead = '.'; //dead cells
char name [ROW1][COL1]; //12by30 2d array
char name2 [12][30]; //another 12by30 2d array
//end of Global variables

//Main Function
int main()
{
int q; //stops terminal window from quitting after programs ends

//call the functions
GetFile();
MakeArray();
ChgArray();
//GameBoard();

//Stop the Program from quitting
cin >> q; //enter any letter to end the program

return 0;
}

//GetFile Function
void GetFile()
{
cout<<"Enter the filename:
";
cin>>filename;
return;
}

//MakeArray Function
char MakeArray()
{
myfile.open (filename.c_str());
for (int r=0; r<12; r++)
{
for (int c=0; c<30; c++)
{
myfile>>name[r][c];
//cout << name[r][c];
}
//cout << endl;
}
}

//ChgArray Function
char ChgArray()
{
//char name2 [12][30];
for (int r=0; r<12; r++)
{
for (int c=0; c<30; c++)
{
name2[r][c]=name[r][c];
//cout<<name2[r][c];
}
//cout<<endl;
}

}
/*/char GameBaord()
{
//do something
}
/*/
[/code]
Sign In or Register to comment.