37 int main(
int argc,
char const *argv[])
45 const std::string full_path_exec{argv[0]};
46 std::string::size_type found = full_path_exec.find_last_of(
"/\\", std::string::npos);
47 const std::string exec_path = full_path_exec.substr(0, found);
48 const std::string exec_filename = full_path_exec.substr(found + 1, std::string::npos);
54 binary_tree.delRight(
"r");
64 std::cout <<
"文件:" << data_file_full_path <<
"生成失败!\n";
69 std::ifstream fin(data_file_full_path.c_str(), std::ios_base::in);
72 std::cout <<
"文件:" << data_file_full_path <<
"读取失败!\n";
77 binary_tree.createTree(
"@", fin);
81 std::ofstream fout(data_file_full_path.c_str(), std::ios_base::app);
84 std::cerr <<
"文件:" << data_file_full_path <<
"写入失败!\n";
89 timeinfo = localtime(&rawtime);
92 std::cout <<
"\nCurrent local time and date: " << asctime(timeinfo) <<
'\n';
93 fout <<
"\nCurrent local time and date: " << asctime(timeinfo) <<
'\n';
98 binary_tree.delLeft(
"L");
99 binary_tree.delRight(
"C");
100 binary_tree.delLeft(
"C");
102 std::cout <<
"\n剪枝后:\n";
109 std::cout <<
"\nIt took me " << t <<
" clicks (" << ((float)t) / CLOCKS_PER_SEC <<
" seconds).\n";
110 fout <<
"\nIt took me " << t <<
" clicks (" << ((float)t) / CLOCKS_PER_SEC <<
" seconds).\n";