Life: The Main Program #include "utility. h #include ife h void main( Pre: The user supplies an initial configuration of living cells Post: The program prints a sequence of pictures showing the changes in the configuration of living cells according to the rules for the game of life Uses: The classLife and its methods initialize u printo,and update The functions instructions(, user says yeso
Life: The Main Program #include "utility.h" #include "life.h" void main( ) /* Pre: The user supplies an initial configuration of living cells. Post: The program prints a sequence of pictures showing the changes in the configuration of living cells according to the rules for the game of Life. Uses: The classLife and its methods initialize(), print(),and update(). The functions instructions(), user_says_yes(). */
i void instructions(); Life configuration; instructions() configuration initialize configuration print( cout <<" Continue viewing new generations? n while(user says yes()) i configuration. update( configuration. print() cout<< Continue viewing new generations?n
{ 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"; } }
Examples of life Configurations 十十十十 f十十十1 (f)
Examples of Life Configurations
Examples of Life Configurations(continue) ●。●●● ) (k)
Examples of Life Configurations(continue)
1. 3 Programming style 1.3.1 names Guidelines for Choosing Names Programming Precept Always name your classes variables, and functions with the greatest care, and explain them thoroughly
1.3.1 names Guidelines for Choosing Names 1.3 Programming style Programming Precept Always name your classes, variables, and functions with the greatest care, and explain them thoroughly