📄 dtn_question_2.cc
字号:
// file: dtn_question_2.cc//// system include files//#include <string.h>// isip include files//#include "dt_node.h"#include "dt_node_constants.h"// method: ask_opt_question_cc//// arguments:// Hash_table* answer: (input) Hash_table with all the answers// int_4 l_context: (input) the left contexts // int_4 r_context: (input) the right contexts // return: a logical_1 indicating if the answer is yes or no//// this method asks the optimal question given the left abd right context//logical_1 Dt_node::ask_opt_question_cc(Hash_table* answer_a, int_4 l_context_a, int_4 r_context_a) { // local variables // char_1* key_string = new char_1[ISIP_MAX_STRING_LENGTH]; logical_1 tag_left; int_4 num;;; char_1* attribute; int_4 phn; char_1* dire= new char_1[2]; num = opt_question_d->get_num_cc(); attribute = opt_question_d->get_attribute_cc(); tag_left = opt_question_d->get_direction_cc(); if(tag_left == ISIP_TRUE) { phn = l_context_a; strcpy((char*)dire, "L"); } else { phn = r_context_a; strcpy((char*)dire, "R"); } // create the key string // sprintf((char*)key_string, "%ld", phn); strcat((char*)key_string, " "); strcat((char*)key_string, (char*)dire); strcat((char*)key_string, " "); strcat((char*)key_string, (char*)attribute); // look up the answer // if((answer_a->hash_lookup_cc(key_string)) == (Hash_cell*)NULL) { // free memory // delete [] key_string; delete [] dire; // exit gracefully with the answer no // return ISIP_FALSE; } // free memory // delete [] key_string; delete [] dire; // exit gracefully with the answer yes // return ISIP_TRUE; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -