?? lifemain.cpp
字號:
#include <iostream.h>
#include "utility.h"
#include "life.h"
void main( ) // Program to play Conway's game of Life.
/* Pre: The user supplies an initial configuration of living cells.
Post: The program prints a sequence of pictures showing the changes in the conguration
of living cells according to the rules for the game of Life.
Uses: The classLife and its methodsinitialize(),print(),and update().
The functions instructions(), user_says_yes(). */
{ void instructions( ); Life configuration;
instructions( );
configuration.initialize( );
configuration.print( );
cout << "Continue viewing new generations?\n ";
while (user_says_yes( ))
{ configuration.update( );
configuration.print( );
cout << "Continue viewing new generations?\n";
}
}
void instructions( )
/* Pre: None.
Post: Instructions for using theLife program have been printed. */
{
cout<<"Welcome to Conway's game of Life.\n";
cout<<"This game uses a grid of size ";
cout<<maxrow<<" by "<<maxcol<<" in which each\n";
cout << "cell can either be occupied by an organism or not." << endl;
cout << "The occupied cells change from generation to generation\n";
cout << "according to how many neighboring cells are alive.\n";
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -