# include # include # include "ppc_array.h" # include "ppc_evolution.h" # include "ppc_evolution_io.h" int main ( ); void timestamp ( ); /******************************************************************************/ int main ( ) /******************************************************************************/ /* Purpose: ppc_evolution_io_test() tests ppc_evolution_io(). Licensing: This code is distributed under the MIT license. Modified: 24 May 2024 Author: John Burkardt Reference: Rouben Rostamian, Programming Projects in C for Students of Engineering, Science, and Mathematics, SIAM, 2014, ISBN: 978-1-611973-49-5 */ { int result; struct world World; struct world *world = &World; timestamp ( ); printf ( "\n" ); printf ( "ppc_evolution_io_test():\n" ); printf ( " C version\n" ); printf ( " Test ppc_evolution_io().\n" ); world->herd = NULL; world->plants = NULL; result = read_wdf ( world ); if ( ! result ) { free_matrix ( world->plants ); /* free_herd ( world->herd ); */ printf ( "\n" ); printf ( "ppc_evolution_io_test():\n" ); printf ( " Abormal end of execution.\n" ); timestamp ( ); return 1; } result = write_wdf ( world, "copy.wdf" ); /* Terminate. */ printf ( "\n" ); printf ( "ppc_evolution_io_test():\n" ); printf ( " Normal end of execution.\n" ); timestamp ( ); return 0; } /******************************************************************************/ void timestamp ( ) /******************************************************************************/ /* Purpose: timestamp() prints the current YMDHMS date as a time stamp. Example: 17 June 2014 09:45:54 AM Licensing: This code is distributed under the MIT license. Modified: 01 May 2021 Author: John Burkardt */ { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct tm *tm; time_t now; now = time ( NULL ); tm = localtime ( &now ); strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm ); printf ( "%s\n", time_buffer ); return; # undef TIME_SIZE }