# include # include # include # include # include # include using namespace std; # include "triangle_svg.hpp" int main ( ); void test01 ( ); void timestamp ( ); //****************************************************************************80 int main ( ) //****************************************************************************80 // // Purpose: // // triangle_svg_test() tests triangle_svg(). // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 21 April 2014 // // Author: // // John Burkardt // { timestamp ( ); cout << "\n"; cout << "TRIANGLE_SVG_TEST():\n"; cout << " C++ version\n"; cout << " Test TRIANGLE_SVG().\n"; test01 ( ); // // Terminate. // cout << "\n"; cout << "TRIANGLE_SVG_TEST():\n"; cout << " Normal end of execution.\n"; cout << "\n"; timestamp ( ); return 0; } //****************************************************************************80 void test01 ( ) //****************************************************************************80 // // Purpose: // // TEST01 calls TRIANGLE_SVG to plot a triangle and some points. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 21 April 2014 // // Author: // // John Burkardt // { double p[2*13] = { 0.333333333333333, 0.333333333333333, 0.479308067841923, 0.260345966079038, 0.260345966079038, 0.479308067841923, 0.260345966079038, 0.260345966079038, 0.869739794195568, 0.065130102902216, 0.065130102902216, 0.869739794195568, 0.065130102902216, 0.065130102902216, 0.638444188569809, 0.312865496004875, 0.638444188569809, 0.048690315425316, 0.312865496004875, 0.638444188569809, 0.312865496004875, 0.048690315425316, 0.048690315425316, 0.638444188569809, 0.048690315425316, 0.312865496004875 }; int p_num = 13; string plot_filename = "test01.svg"; double t[2*3] = { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0 }; triangle_svg ( plot_filename, t, p_num, p ); return; } //****************************************************************************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: // // 08 July 2009 // // 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 }