int tr_fl(int q_no) { char tf,ter; if(q_no==4) { ques(4); printf("\n\nAll metals are ductile.(t/f)"); printf("\n\nType \"t\" for TRUE\tor \"f\" for FALSE"); ter=check(); if(ter==14) goto end; flushall(); printf("\n\nYOUR OPINION:-\t"); scanf("%c",&tf); if(tf=='f') { correct(); return 1; } else printf("\n\n\a\aIT IS A FALSE STATEMENT"); getch(); } if(q_no==6) { ques(6); printf("\n\nUnicellular organisms have one celled body.(t/f)"); printf("\n\nType \"t\" for TRUE\tor \"f\" for FALSE"); ter=check(); if(ter==14) goto end; flushall(); printf("\n\nYOUR OPINION:-\t"); scanf("%c",&tf); if(tf=='t') { correct(); return 1; } else printf("\n\n\a\aIT IS A TRUE STATEMENT"); getch(); } end: return 0; }
/* * Matches the first part of text against the first part of re */ static int expr (const char *text, const char *re, struct mstruct *m) { int i = 0; if (re[0] == '\0') { m->end = text; return 1; } if (re[0] == '$' && re[1] == '\0') { m->end = text; return text[0] == '\0'; } if (re[0] == ESCAPE_CHAR) { if (re[1] == 'i') { m->flags |= CASE_INSENSITIVE; return expr (text, re + 2, m); } else if (re[1] == 'I') { m->flags &= ~CASE_INSENSITIVE; return expr (text, re + 2, m); } i++; } else if (re[0] == '[' && ++i) while (re[i] != ']') { if (re[i] == '\0') return 0; /* syntax error */ if (re[i] == ESCAPE_CHAR) i++; i++; } if (re[i + 1] == '*') return star (text, re, re + i + 2, m); if (re[i + 1] == '+') return plus (text, re, re + i + 2, m); if (re[i + 1] == '?') return ques (text, re, re + i + 2, m); if (text[0] && atom (text, re, m)) return expr (text + 1, re + i + 1, m); return 0; }
void CrashDialog::onSaveClicked() { _pressedButton = _saveReportButton; QString fileName = _filePath; fileName.replace( QLatin1Char('\\'), QLatin1Char('/') ); int foundLastSep = fileName.lastIndexOf( QLatin1Char('/') ); if (foundLastSep != -1) { fileName = fileName.mid(foundLastSep + 1); } fileName = QDir::homePath() + QLatin1Char('/') + fileName; bool saveOk = false; QString saveFileName = QFileDialog::getSaveFileName(this, tr("Save report"), fileName, QString::fromUtf8("*.dmp"), 0, 0); if ( !saveFileName.isEmpty() ) { saveOk = QFile::copy(_filePath, saveFileName); } else { return; } if (!saveOk) { QMessageBox ques(QMessageBox::Critical, tr("Invalid filename"), tr("The issue could not be saved to: ") + saveFileName, QMessageBox::Ok, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint); ques.setWindowFlags(ques.windowFlags() | Qt::WindowStaysOnTopHint); ques.exec(); return; } accept(); }
void CrashDialog::onSendClicked() { QString description = _descEdit->toPlainText(); if ( description.isEmpty() ) { QMessageBox ques(QMessageBox::Question, tr("Empty description"), tr("The issue report doesn't have any description. " "Would you like to send it anyway?"), QMessageBox::Yes | QMessageBox::No, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint); ques.setDefaultButton(QMessageBox::No); ques.setWindowFlags(ques.windowFlags() | Qt::WindowStaysOnTopHint); if ( ques.exec() ) { QMessageBox::StandardButton rep = ques.standardButton( ques.clickedButton() ); if (rep != QMessageBox::Yes) { return; } } } _pressedButton = _sendButton; accept(); }
int numerical(int q_no) { int ans_7,ans_10,ter; clrscr(); //****************QUESTION 7********************** if(q_no==7) { ques(7); printf("\n\nA Student of class 8th carries a bag of weight 10N on his shoulders.\n\nThe Pressure exerted on his shoulders by the strips of the bag is 2.5N/cm%c\n\n",253); printf("Find CROSS SECTIONAL AREA OF THE STRIPS (in cm%c) ?",253); printf("\n\n\nHINT:- The weight of bag is already given in terms of the force acting\n~~~~~~~~ on the shoulders.\n\n\"pressure is the force acting per unit area\""); ter=check(); if(ter==14) goto end; printf("\n\n\nYOUR ANSWER:-\t"); scanf("%d",&ans_7); if(ans_7==4) { correct(); return 1; } else printf("\n\n\n\a\aTHE CORRECT ANSWER IS 4 cm%c.",253); getch(); } //*********QUESTION 10******************* if(q_no==10) { ques(10); printf("\n\nA Car starts from pune airport at 10:30 AM, travels at a speed of 10 m/s\n\nand reaches K.V-1 after travelleling 6 Km."); printf("\n\nAt WHAT TIME it reaches K.V-1 ?"); printf("\n\n\nIMPORTANT NOTE:::::if your answer is 10:54 AM then type\"1054\"\n\t\tif your answer is 10:50 AM then type \"1050\""); printf("\n\nSO CALCULATE THE ANSWER & TYPE IT ACCORDINGLY"); ter=check(); if(ter==14) goto end; printf("\n\n\nYOUR ANSWER:-\t"); scanf("%d",&ans_10); if(ans_10==1040) { correct(); return 1; } else printf("\n\n\n\a\aTHE CORRECT ANSWER IS 10:40 AM"); } end: return 0; }
int mcq(int q_no) { int op,ter; clrscr(); if(q_no==1) { ques(1); printf("\n\nAngle of Incidence = Angle of Reflection"); printf("\n\n1. Always\n2. Sometimes\n3. Under Special conditions\n4. Never"); printf("\n\nCHOOSE CORRECT ANSWER"); ter=check(); if(ter==14) goto end; printf("\n\nYOUR OPTION:-\t"); scanf("%d",&op); if(op==1) { correct(); return 1; } else printf("\n\n\a\aOPTION 1 is the correct answer"); getch(); } if(q_no==2) { ques(2); printf("\n\nKOH is the symbol of"); printf("\n\n1. Sodium Hydroxide\n2. Phosphorous Dioxide \n3. Potassium Hydroxide\n4. Iron Oxide"); printf("\n\nCHOOSE CORRECT ANSWER"); ter=check(); if(ter==14) goto end; printf("\n\nYOUR OPTION:-\t"); scanf("%d",&op); if(op==3) { correct(); return 1; } else printf("\n\n\a\aOPTION 3 is the correct answer"); getch(); } if(q_no==8) { ques(8); printf("\n\nWhite Blood Cells (WBC)"); printf("\n\n1. Smaller In Size than RBC's\n2. More than RBC's\n3. Help In DIGESTION \n4. Provide IMMUNITY to the body"); printf("\n\nCHOOSE CORRECT ANSWER"); ter=check(); if(ter==14) goto end; printf("\n\nYOUR OPTION:-\t"); scanf("%d",&op); if(op==4) { correct(); return 1; } else printf("\n\n\a\aOPTION 4 is the correct answer"); getch(); } end: return 0; }
int fil_blnk(int q_no) { int i,ter; char flans[20]; if(q_no==3) { ques(3); printf("\n\nanswer in small case letters"); printf("\n\nHuman Voice box is also known as ______"); for(i=0;i<6;i++) printf("\b"); ter=check(); if(ter==14) goto end; flushall(); gets(flans); if(strcmp(flans,"larynx")==0) { correct(); return 1; } else printf("\n\n\a\aThe Correct answer is \"LARYNX\""); getch(); } if(q_no==5) { ques(5); printf("\n\nanswer in small case letters"); printf("\n\n\"Ferrous\" is the scientific name of ____"); for(i=0;i<4;i++) printf("\b"); ter=check(); if(ter==14) goto end; flushall(); gets(flans); if(strcmp(flans,"iron")==0) { correct(); return 1; } else printf("\n\n\a\aThe Correct answer is \"IRON\""); getch(); } if(q_no==9) { ques(9); printf("\n\nanswer in small case letters"); printf("\n\nThe Process of depositing a layer of metal on \n\t\tanother metal using electicity is called as _____________"); for(i=0;i<13;i++) printf("\b"); ter=check(); if(ter==14) goto end; flushall(); gets(flans); if(strcmp(flans,"electroplating")==0) { correct(); return 1; } else printf("\n\n\a\aThe Correct answer is \"ELECTROPLATING\""); getch(); } end: return 0; }
int main(int argc, const char* argv[]) { try { std::string qdataxmlfilen; if(argc < 2) { if(getenv("QDATA_XML_FILE") == NULL) { std::cout << "Please set the QDATA_XML_FILE variable or supply an argument." << std::endl; exit(0); } else { qdataxmlfilen = getenv("QDATA_XML_FILE"); } } else { qdataxmlfilen = argv[1]; } std::auto_ptr<qdata_t> doc(qdata(qdataxmlfilen)); YAML::Node outdoc; if(std::string(doc->type()) == "ELEMENT") { if(!doc->header().present()) { std::cout << "Document declared ELEMENT type, yet missing <header> element." << std::endl; exit(-1); } YAML::Node odoc; outdoc["header"].push_back(odoc); header_t h = doc->header().get(); odoc["name"] = std::string(h.name()); odoc["author"] = std::string(h.author()); odoc["description"] = std::string(h.description()); odoc["extra"] = std::string(h.extra()); odoc["maxquestions"] = int(h.maxquestions()); if(h.skipoverride().present()) odoc["skipoverride"] = bool(h.skipoverride().get()); if(h.answernumberinput().present()) odoc["answernumberinput"] = bool(h.answernumberinput().get()); if(h.skipisincorrect().present()) odoc["skipisincorrect"] = bool(h.skipisincorrect().get()); if(h.quizmode().present()) odoc["quizmode"] = bool(h.quizmode().get()); if(!doc->questions().present()) { std::cout << "Document declared ELEMENT type, yet missing <questions> element." << std::endl; exit(-1); } YAML::Node qdoc; outdoc["questions"].push_back(qdoc); questions_t q = doc->questions().get(); questions_t::problem_sequence& qseq = q.problem(); int index = 1; for(questions_t::problem_iterator iter = qseq.begin(); iter != qseq.end(); iter++) { question_t ques(*iter); YAML::Node cques; qdoc["q" + toString(index)].push_back(cques); cques["question"] = std::string(ques.question()); answers_t answers = ques.answers(); YAML::Node answersnode; cques["answers"] = answersnode; answers_t::answer_sequence& aseq = answers.answer(); for(answers_t::answer_iterator iter2 = aseq.begin(); iter2 != aseq.end(); iter2++) { answersnode.push_back(std::string(*iter2)); } cques["correctanswer"] = int(ques.correctanswer()); index++; } } else if (std::string(doc->type()) == "ATTRIBUTE") { if(!doc->headera().present()) { std::cout << "Document declared ATTRIBUTE type, yet missing <headera> element." << std::endl; exit(-1); } YAML::Node odoc; outdoc["header"] = odoc; headera_t h = doc->headera().get(); odoc["name"] = std::string(h.name()); odoc["author"] = std::string(h.author()); odoc["description"] = std::string(h.description()); odoc["extra"] = std::string(h.extra()); odoc["maxquestions"] = int(h.maxquestions()); if(h.skipoverride().present()) odoc["skipoverride"] = bool(h.skipoverride().get()); if(h.answernumberinput().present()) odoc["answernumberinput"] = bool(h.answernumberinput().get()); if(h.skipisincorrect().present()) odoc["skipisincorrect"] = bool(h.skipisincorrect().get()); if(h.quizmode().present()) odoc["quizmode"] = bool(h.quizmode().get()); if(!doc->questionsa().present()) { std::cout << "Document declared ATTRIBUTE type, yet missing <questionsa> element." << std::endl; exit(-1); } YAML::Node qdoc; outdoc["questions"] = qdoc; questionsa_t q = doc->questionsa().get(); questionsa_t::problem_sequence& qseq = q.problem(); int index = 1; for(questionsa_t::problem_iterator iter = qseq.begin(); iter != qseq.end(); iter++) { questiona_t ques(*iter); YAML::Node cques; qdoc["q" + toString(index)] = cques; cques["question"] = std::string(ques.question()); answersa_t answers = ques.answers(); YAML::Node answersnode; cques["answers"] = answersnode; answersa_t::answer_sequence& aseq = answers.answer(); for(answersa_t::answer_iterator iter2 = aseq.begin(); iter2 != aseq.end(); iter2++) { answera_t ans(*iter2); answersnode.push_back(std::string(ans.value())); } cques["correctanswer"] = int(ques.correctanswer()); index++; } } std::ofstream fout((doc->name() + ".lsybin").c_str()); if(fout.is_open()) { fout << outdoc; fout.close(); } else { std::cout << "Error opening/creating file." << std::endl; exit(0); } } catch (const xml_schema::exception& ex) { std::cout << ex << std::endl; } }