Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Game of Life
- //Dylan Metz
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <cstring>
- using namespace std;
- //function(s)
- 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';
- char dead = '.';
- char name [ROW1][COL1];
- //end of Global variables
- int main()
- {
- int q; //stops terminal window from quitting
- //call functions
- GetFile();
- MakeArray();
- ChgArray();
- //Stop Program from quitting
- cin >> q;
- return 0;
- }
- //Other Functions
- void GetFile()
- {
- cout<<"Enter the filename: \n";
- cin>>filename;
- return;
- }
- 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;
- }
- }
- 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement