MCPcopy Create free account
hub / github.com/Rustam-Z/cpp-programming / question9

Function question9

Project_Quiz_Game/quiz-game.cpp:539–717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537 }
538}
539void question9() {
540 cout << " ***********************************" << endl;
541 cout << " ***** TOTAL SCORE:" << total_score << " *****" << endl;
542 cout << " ***********************************" << endl;
543 hints();
544 cout << "\t\t\t\t\t Q U E S T I O N No. 9" << endl;
545 cout << "What is the result of the program below?" << endl;
546 cout << " int x = 10; " << endl;
547 cout << " int y = 70; " << endl;
548 cout << " x = x + y; " << endl;
549 cout << " y = x - y; " << endl;
550 cout << " x = x - y; " << endl;
551 cout << endl;
552 cout << "[1] x=70, y=10" << endl;
553 cout << "[2] x=10, y=70" << endl;
554 cout << "[3] x=60, y=20" << endl;
555 cout << "[4] x=20, y=60" << endl;
556 string answer;
557 cout << endl;
558 cout << "\t\t\t\t\tENTER YOUR CHOICE: ";
559 cin >> answer;
560 if (answer == "1" || answer == "2" || answer == "3" || answer == "4")
561 {
562 if (answer == "1") {
563 total_score += 10;
564 correct_answer += 1;
565 cout << "C O R R E C T A N S W E R !!!" << endl;
566 cout << "You got 10 points out of 10." << endl;
567
568 }
569 else if (answer == "2" || answer == "3" || answer == "4")
570 {
571 cout << "W R O N G A N S W E R !!!" << endl;
572 cout << "You got 0 points out of 10." << endl;
573
574 }
575 cout << endl;
576 system("pause");
577 system("cls");
578 }
579 else if (answer == "A" || answer == "a")
580 {
581 hints_used++;
582 cout << endl;
583 cout << "Audience prediction is... " << endl;
584 cout << "[1] 30%" << endl;
585 cout << "[2] 25%" << endl;
586 cout << "[3] 20%" << endl;
587 cout << "[4] 25%" << endl;
588 cout << endl;
589 cout << "\t\t\t\t\tENTER YOUR CHOICE: ";
590 cin >> answer;
591 if (answer == "1") {
592 total_score += 5;
593 correct_answer += 1;
594 cout << "C O R R E C T A N S W E R !!!" << endl;
595 cout << "You got 5 points out of 5." << endl;
596

Callers 1

mainFunction · 0.85

Calls 1

hintsFunction · 0.85

Tested by

no test coverage detected