# include # include # include using namespace std; # include "vector.hpp" int main ( ); void timestamp ( ); //****************************************************************************80 int main ( ) //****************************************************************************80 // // Purpose: // // vector_test() tests vector(). // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 11 October 2025 // // Author: // // John Burkardt // { int x_in[3] = { 10, 20, 30 }; int x_out[3]; timestamp ( ); cout << "\n"; cout << "vector_test():\n"; cout << " C version\n"; cout << " Test vector(), with the interface:\n"; cout << " vector ( x_in, x_out )\n"; cout << "\n"; cout << " vector ( NULL, NULL )\n"; vector ( NULL, NULL ); cout << "\n"; cout << " vector ( NULL, x_out )\n"; vector ( NULL, x_out ); cout << "\n"; cout << " vector ( x_in, NULL )\n"; vector ( x_in, NULL ); x_in[0] = 100; x_in[1] = 200; x_in[2] = 300; cout << "\n"; cout << " vector ( x_in, x_out )\n"; vector ( x_in, x_out ); // // Terminate. // cout << "\n"; cout << "vector_test():\n"; cout << " Normal end of execution.\n"; cout << "\n"; timestamp ( ); return 0; } //****************************************************************************80 void timestamp ( ) //****************************************************************************80 // // Purpose: // // timestamp() prints the current YMDHMS date as a time stamp. // // Example: // // 31 May 2001 09:45:54 AM // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 19 March 2018 // // Author: // // John Burkardt // { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct std::tm *tm_ptr; std::time_t now; now = std::time ( NULL ); tm_ptr = std::localtime ( &now ); std::strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm_ptr ); std::cout << time_buffer << "\n"; return; # undef TIME_SIZE }