本文整理汇总了C++中Problem::addItems方法的典型用法代码示例。如果您正苦于以下问题:C++ Problem::addItems方法的具体用法?C++ Problem::addItems怎么用?C++ Problem::addItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Problem
的用法示例。
在下文中一共展示了Problem::addItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: procReal
bool SimpleProblemMaker::procReal()
{
int num_ex, num_real;
///////////////////// 문제생성
Problem prob;
num_ex = std::rand() % tokenizer->word_cnt_real;
num_real = tokenizer->atWordRealToken(num_ex);
std::string solution = tokenizer->tokens[num_real].getToken();
tokenizer->tokens[num_real].setProbNum((char)1);
problem_content = tokenizer->cascadeData();
prob.pcontent = "빈칸에 알맞은 단어를 고르시오.";
int sol = std::rand() % 4;
for (int i=0; i<4; i++)
{
if (sol == i)
{
prob.addItems(solution, 1);
} else {
prob.addItems(dic->getRandomWord(), 0);
}
}
problem.push_back(prob);
return true;
}
示例2: procExistDic
bool SimpleProblemMaker::procExistDic()
{
int num_ex, num_real;
bool bOrigin = false;
///////////////////// 문제생성
Problem prob;
num_ex = std::rand() % tokenizer->word_cnt_exist_dic;
num_real = tokenizer->atWordExistDBToken(num_ex);
std::string solution = tokenizer->tokens[num_real].getToken();
if (!dic->exsistWord(solution))
bOrigin = true;
tokenizer->tokens[num_real].setProbNum((char)1);
problem_content = tokenizer->cascadeData();
prob.pcontent = "빈칸에 알맞은 단어를 고르시오.";
int sol = std::rand() % 4;
std::string simstr[3];
if (!dic->getRandomSimItems(solution, simstr, 3))
{
return false;
}
int simcnt = 0;
for (int i=0; i<4; i++)
{
std::string tmp;
if (sol == i)
{
tmp = solution;
if (bOrigin)
{
tmp = tokenizer->tokens[num_real].getOrigin();
}
prob.addItems(solution, 1);
} else {
tmp = simstr[simcnt++];
prob.addItems(tmp, 0);
}
std::string res = dic->getWordInfo(tmp).mean;
if (res == "")
res = getTranslate(res);
prob.feedback += "(" + tmp + "): " + res + "\r";
}
problem.push_back(prob);
return true;
}