当前位置: 首页>>代码示例>>C++>>正文


C++ Question类代码示例

本文整理汇总了C++中Question的典型用法代码示例。如果您正苦于以下问题:C++ Question类的具体用法?C++ Question怎么用?C++ Question使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Question类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Antidote

    Deferoxamine::Deferoxamine(double age, double height, double weight) : Antidote(age, height, weight) {
        string a = "Deferoxamine (iron toxicity) Antidote Algorithm ",
        b = string("For the treatment of acute iron toxicity.  ") + FDA + "\n\n",
        c = "\n (Mills KC, 1994) (Anderson, 1994) (Novartis, 2011)";
        insertToMap("ageLessThanThree", new Question(a + b + "Safety and effectiveness in pediatric patients under the age of " +
                                                     "3 years have not been established." + c));
        string *defOptions = new string[2];
        defOptions[0] =  "CV shock";
        defOptions[1] = "No CV complications";
        Question *isPatientCVShock = new Question("Is this patient in cardiovascular (CV) shock?");
        isPatientCVShock->setOptions(defOptions, 2);
        insertToMap("isPatientCVShock?", isPatientCVShock);
        insertToMap("give1GramIV", new Question(a + b + "Give 1gram IV every 4-8 hours if needed up to 6grams in 24 hours." + c));
        insertToMap("giveIVUpTo1", new Question(a + b + "Give " + toStr(weightkg * 40) + " mg to 1000mg IV every 4-8 hours if needed, up to " +
                                                "6 grams in 24 hours." + c));
        insertToMap("giveIVMore", new Question(a + b + "Give " + toStr(weightkg * 40) + " mg to " + toStr(weightkg * 90) + " mg IV every 4-8 hours if needed," +
                                               "up to 6 grams in 24 hours." + c));
        
        insertToMap("give1GramIM", new Question(a + b + "Give 1gram IM every 4-8 hours if needed up to 6grams in 24 hours." + c));
        insertToMap("giveIMUpTo1", new Question(a + b + "Give " + toStr(weightkg * 40) + " mg to 1000mg IM every 4-8 hours if needed, up to " +
                                                "6 grams in 24 hours." + c));
        insertToMap("giveIMMore", new Question(a + b + "Give " + toStr(weightkg * 40) + " mg to " + toStr(weightkg * 90) + " mg IM every 4-8 hours if needed, " +
                                               "up to 6 grams in 24 hours." + c));
        
        insertToMap("giveIV1Gram", new Question(a + b + "Initially, 1 g IV. Follow with 500 mg IM every 4 hours for 2 doses, " +
                                                "then 500 mg IM every 4 to 12 hours if needed up to a maximum of 6 grams " +
                                                "in 24 hours." + c));
        insertToMap("giveIM1Gram", new Question(a + b + "Initially, 1 g IM. Follow with 500 mg IM every 4 hours for 2 doses, " +
                                                "then 500 mg IM every 4 to 12 hours if needed up to a maximum of 6 grams " +
                                                "in 24 hours." + c));

        
    }
开发者ID:jasonlu,项目名称:libAntidote,代码行数:33,代码来源:Deferoxamine.cpp

示例2:

bool Question::operator < (const Question & that) const
{
    if(this->getQuestion() != that.getQuestion()) {
        return this->getQuestion() < that.getQuestion();
    }
    return this->getAnswer() < that.getAnswer();
}
开发者ID:SuRaMoN,项目名称:lale,代码行数:7,代码来源:question.cpp

示例3: tableName_questions

bool Theme::selectFromDatabase( const SQLMgr &sqlManager, const qint64 questionsCount, const int answersCount )
{
    const QString tableName_questions( "Questions" );
    const QStringList selectedFields( { "question_id", "text", "question_type",
                                      "recomended_time", "caseSens", "stripSpace" } );

    SqlWhere _where( "theme_id = '" + _id + "'" );

    if( _where.isValid() )
    {
        QSqlQuery query = sqlManager.select( tableName_questions, selectedFields, _where, SqlOrderBy::RANDOM(), questionsCount );


        while( query.next() )
        {
            Question question = selectQuestion( query );
            QVector<Answer> answers = selectAnswers( sqlManager, answersCount, question.getId() );

            question.setAnswers( answers );
            pushQuestion( question );
        }

        return true;
    }
    return false;
}
开发者ID:TheCodingArt,项目名称:QTester,代码行数:26,代码来源:theme.cpp

示例4: in

int Question::initialize_print_all()
{
	const char* file_name = Configuration::configuration->get_q_file();
	ifstream in(file_name, ios::in | ios::binary);
	if (!in.is_open())
	{
		return FILE_OPEN_ERR;
	}
	TestingSystem::question_msg q_msg;
	string s;
	q_msg.set_id(-1);
	while (in.cur!= in.eof())
	{
		char c;
		in.read(&c, sizeof c);
		s += c;
		if (!q_msg.ParseFromString(s))
			q_msg.set_id(-1);
		else
		{
			Question q;
			q.initialize_obj(q_msg);
			q.print();
			s="";
		}
	}
	return SUCCESS;
}
开发者ID:MaxMyalkin,项目名称:TestingSystem,代码行数:28,代码来源:Question.cpp

示例5: initQuestions

void QuestionSetCubics::initQuestions( Question::List &questions )
{
  for( int b = 1; b <= 10; ++b ) {
    Question q;
    q.setQuestion( QString::number( b ) + " cube" );
    q.setAnswer( QString::number( b * b * b ) );
    questions.append( q );
  }
}
开发者ID:cornelius,项目名称:plutimikation,代码行数:9,代码来源:questionsetcubics.cpp

示例6: displayQuestion

bool DialogueManager::displayQuestion() {
	if (_q->textIsNull()) return false;

	_balloonMan->setSingleBalloon(_q->_text, _ballonPos._questionBalloon.x, _ballonPos._questionBalloon.y, _q->balloonWinding(), BalloonManager::kNormalColor);
	_faceId = _gfx->setItem(_questioner, _ballonPos._questionChar.x, _ballonPos._questionChar.y);
	_gfx->setItemFrame(_faceId, _q->speakerMood());

	return true;
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:9,代码来源:dialogue.cpp

示例7: setQuestion

void BftpMaker::add()
{
    Question q;
    q.setText(tr("empty"));
    q.addAnswer(Answer(tr("empty"), false));
    q.addAnswer(Answer(tr("empty"), false));
    q.addAnswer(Answer(tr("empty"), false));
    _test.insertQuestion(++_currentQ, q);
    setQuestion(_currentQ);
}
开发者ID:RussianBruteForce,项目名称:bftp,代码行数:10,代码来源:BftpMaker.cpp

示例8: datamatrixToQuestions

bool Import::datamatrixToQuestions(){
    bool success = false;

    cout << "START READING DATA TO QUESTION OBJECTS" << endl;
// fills CSV Data from vector < vector <...> > datamatrix to questiondata objects.

    int m = dataMatrix[0].size();

    // check dimensions of datamatix
    if(m!=questionTypes.size()){


        cout << "ERROR: number of survey questions != number of questiontypes" << endl;

        QMessageBox msgBox;
        msgBox.setText("FEHLER: Der ausgewählte Ausstellungstyp passt nicht zur .CSV Datei.");
        msgBox.setInformativeText("Bitte richtigen Ausstellungstyp wählen.");
        msgBox.setDefaultButton(QMessageBox::Ok);
        int ret = msgBox.exec();

        success = false;
        return success;
    }

    int id=0;

    for(int i=0; i<m;++i){


        if(questionTypes[i].toInt()!=0){

            Question *tempQuestion = new Question;

            tempQuestion->setQuestiontype(questionTypes[i].toInt());
            tempQuestion->setQuestion(QString::fromStdString(dataMatrix[0][i]));
            tempQuestion->setSubquestion(QString::fromStdString(dataMatrix[1][i]));

            if(tempQuestion->getQuestionType()!=6)
                tempQuestion->setDataFromStdStringMatrix(dataMatrix,i);

            else
                tempQuestion->setTextAnswersFromStdStringMatrix(dataMatrix,i);

            if(tempQuestion->getQuestion()!="")
                ++id;


            tempQuestion->write_ID(id);      // a question and its subquestions share the same id

            questions.push_back(*tempQuestion);
            delete tempQuestion;
            }

        }

    success=true;
    return success;
}
开发者ID:farrutapps,项目名称:AFZApp,代码行数:58,代码来源:import.cpp

示例9: kdError

void MainView::checkAnswer()
{
  if ( mQuestions.count() == 0 ) {
    kdError() << "checkAnswer(): no questions." << endl;
    return;
  }

  mReadyTimer.stop();

  Question q = *mCurrentQuestion;

  QString text = "<qt>";
  if ( mAnswerEdit->text() == q.answer() ) {
    text += i18n("Correct answer:");
    mResultView->incrementCurrentCount();
    mQuestions.remove( mCurrentQuestion );
  } else {
    text += "<font color=\"red\">" + i18n("Wrong answer.") + "</font><br>";
    text += i18n("Correct Answer:");
    mResultView->incrementWrongCount();
  }
  text += "<br>";
  text += q.question() + " = " + q.answer();
  text += "</qt>";

  mFeedbackText->setText( text );
  
  if ( mQuestions.count() == 0 ) {
    QString text = "<qt>";
    text += i18n("<b>Congratulation!</b><br/>");
    text += i18n("You answered all questions.<br/>");
    text += "<br/>";
    if ( mResultView->wrongCount() == 0 ) {
      text += i18n("You gave no wrong answers.");
    } else {
      text += i18n("You gave one wrong answer.",
        "You gave %n wrong answers", mResultView->wrongCount() );
    }
    text += "<br/>";
    text += mResultView->rating();
    text += "</qt>";
    
    KMessageBox::information( this, text );

    mQuestionLabel->setText( "" );
    mAnswerEdit->setText( "" );
    mAnswerEdit->setEnabled( false );
    mOkButton->setEnabled( false );
    mFeedbackText->setText( i18n("You won.") );
  } else {
    newQuestion();
  }
}
开发者ID:cornelius,项目名称:plutimikation,代码行数:53,代码来源:mainview.cpp

示例10: mixStructureOfQuestion

void OpenQuestionSet::mixStructureOfQuestion(Question &questionToMix)
{

    int sizeOf = questionToMix.getAnswerVector().size();
    std::uniform_int_distribution<int> distAns (0, sizeOf-1 );
   
    for (int i = 10 ; i >= 0 ; --i )
    {
        int random1 = distAns(mt);
        int random2 = distAns(mt);
        swap(questionToMix.getAnswerVector().at(random1), questionToMix.getAnswerVector().at(random2))  ;
    }
}
开发者ID:GrzegorzDuraj,项目名称:questionTEST,代码行数:13,代码来源:OpenQuestionSet.cpp

示例11: openNewQuestion

void OpenQuestionSet::openNewQuestion()
{
    Question q = allQuestionSet->getNewQuestioin();
    if (q.getQuestion().empty())
    {
        sizeOfOpenQuestion--;
    }
    else
    {
        openQuestion.push_back(q);
    }

}
开发者ID:GrzegorzDuraj,项目名称:questionTEST,代码行数:13,代码来源:OpenQuestionSet.cpp

示例12: initQuestions

void QuestionSetMultiplication::initQuestions( Question::List &questions )
{
  QValueList<int> rows = Prefs::multiplicationRows();
  QValueList<int>::ConstIterator it;
  for( it = rows.begin(); it != rows.end(); ++it ) {
    int a = *it;
    for( int b = 1; b <= 10; ++b ) {
      Question q;
      q.setQuestion( QString::number( b ) + " \xb7 " + QString::number( a ) );
      q.setAnswer( QString::number( a * b ) );
      questions.append( q );
    }
  }
}
开发者ID:cornelius,项目名称:plutimikation,代码行数:14,代码来源:questionsetmultiplication.cpp

示例13: Antidote

    CrotalidaeOvine::CrotalidaeOvine(double age, double height, double weight) : Antidote(age, height, weight) {
        
        string a = "Crotalidae (pit viper) Antivenin Algorithm\n",
        b = string("For the treatment of Crotalidae or pit viper envenomation.  ") + FDA + "\n\n",
        c = " (Protherics Inc., 2008)";

        string stringInfantsChildren = b + " Dosing for infants and children:\n\n" +
        "The dose of antivenin to be administered to infants and children is expected to be the same. " +
        "Initially 4-6 vials of crotalidae antivenin ovine should be administered at a rate " +
        "of 25-50 ml/hr for the first 10 minutes with careful observation of any signs of allergic " +
        "reaction.  If no signs exist, increase the rate to 250ml/hr.  After administration of " +
        "antivenin, observe for 1 hour.  If control of envenomation syndrome is not achieved, another " +
        "vials of antivenin may be administered until symptoms have resolved.  Additional doses of 2 vials " +
        "every 6 hours for up to 18 hours as needed.  To date no dose over 18 vials has been used." + c;
        string stringAdolescentAdult = b + " Dosing for adolescents and adults\n\n" +
        "Initially 4-6 vials of crotalidae antivenin ovine should be administered at a rate " +
        "of 25-50 ml/hr for the first 10 minutes with careful observation of any signs of allergic " +
        "reaction.  If no signs exist, increase the rate to 250ml/hr.  After administration of " +
        "antivenin, observe for 1 hour.  If control of envenomation syndrome is not achieved, another " +
        "vials of antivenin may be administered until symptoms have resolved.  Additional doses of 2 vials " +
        "every 6 hours for up to 18 hours as needed.  To date no dose over 18 vials has been used." + c;
        
        string reconsider = string("Please re-consider the use of crotalidae antiventin (ovine) as the equine ") +
        "derived antidote is no longer available in the U.S.";
        
        string *antiveninOptions = new string[2];
        antiveninOptions[0] = "Proceed";
        antiveninOptions[1] = "Exit";
        
        string stringProceedOrExit = string("This product is an ovine (sheep) derivative. ") +
        "Patients allergic to ovine products may have a severe reaction. " +
        "It is recommended that you proceed with Antivenin Crotalidae Ovine therapy " +
        "if the wound is life or limb threatening and provide care for anaphylaxis " +
        "if necessary." + c;
        
        Question *InfantsChildren = new Question(stringInfantsChildren);
        Question *AdolescentAdult = new Question(stringAdolescentAdult);
        Question *ProceedOrExit = new Question(stringProceedOrExit);
        Question *Exit = new Question("");
        ProceedOrExit->setOptions(antiveninOptions, 2);
        
        prompts.insert(strQuestionMapPair("InfantsChildren", InfantsChildren));
        prompts.insert(strQuestionMapPair("AdolescentAdult", AdolescentAdult));
        prompts.insert(strQuestionMapPair("ProceedOrExit", ProceedOrExit));
        prompts.insert(strQuestionMapPair("Exit", Exit));
        
    }
开发者ID:jasonlu,项目名称:libAntidote,代码行数:47,代码来源:CrotalidaeOvine.cpp

示例14: getQuestionInfo

void getQuestionInfo()
{
    QFile file("Question_Info.txt");
    int i=1;
    if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        //QMessageBox::critical(NULL, QObject::tr("提示"), QObject::tr("文件不存在,无法打开文件"));
        //create the file
    }
    else
    {
        QString line,title,time,createid,content;
        QTextStream in(&file);
        while(!in.atEnd())
        {
            line = in.readLine().replace(QString("\n"),QString(""));
            if(i%5==0)
            {
                content = line;
                QuestionReadyToAdd.setBasicContent(content);
                SumQuestionList.push_back(QuestionReadyToAdd);
            }
            else if(i%5==1)
            {
                QuestionReadyToAdd.setBasicInfoId(i);
            }
            else if(i%5==2)
            {
                createid = line;
                QuestionReadyToAdd.setCreatUserId(createid);
            }
            else if(i%5==3)
            {
                time = line;
                QuestionReadyToAdd.setCreatTime(time);
            }
            else
            {
                title=line;
                QuestionReadyToAdd.setQuestionTitle(title);
            }
            i = (i+1)%5;
    }
    file.close();
   }
}
开发者ID:Mr-Phoebe,项目名称:ProgramDesign,代码行数:46,代码来源:main.cpp

示例15: changeQuestion

void MainWindow::changeQuestion(Question question)
{
    ui->question->setText(question.getQuestion());
    currentQuestion = question;
    ui->answer->setText("");
    ui->right->setHidden(true);
    ui->wrong->setHidden(true);
    ui->showAnswer->setHidden(false);
}
开发者ID:SuRaMoN,项目名称:lale,代码行数:9,代码来源:mainwindow.cpp


注:本文中的Question类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。