⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lifemain.cpp

📁 这是本人精心搜集的关于常用图论算法的一套源码
💻 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 conguration
         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";
}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -