Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int choice;
- int wrong=0, right=0, lives=0;
- int answer;
- string questions[20];
- int questionAnswers[20];
- int livesChoice()
- {
- do{
- cout<<"You have chosen Lives mode"<<endl;
- cout<<"Please choose your difficulty"<<endl;
- cout<<"1) Easy (Lives)"<<endl;
- cout<<"2) Medium (Lives)"<<endl;
- cout<<"3) Hard (Lives)"<<endl;
- cout<<"4) Return"<<endl;
- cin>>choice;
- if(choice==1)
- {
- lives==20;
- modeL();
- }
- else if(choice==2)
- {
- lives==10;
- modeL();
- }
- else if(choice==3)
- {
- lives==5;
- modeL();
- }
- else if(choice==4)break;
- }while(true);
- }
- int accuracyChoice()
- {
- do{
- system("cls");
- cout<<"You have one guess per qusetion,"<<endl;
- cout<<"and when you reach the end of the quiz,"<<endl;
- cout<<"your results will be revealed."<<endl;
- cout<<"1) Continue"<<endl;
- cout<<"2) Return"<<endl;
- cin>>choice;
- if(choice==1)
- {
- lives=(-1);
- game(lives):
- }
- else if(choice==2)break;
- }while(true);
- }
- livesGame()
- {
- for(int c=0;c<20;c++)
- {
- cout<<questiosn[c]<<endl;
- cin>>answer;
- if(answer==questionAnswers[c])cout<<"That's correct!"<<endl;
- else lives--;
- if(lives==0)
- {
- cout<<"You lost!"<<endl;
- break;
- }
- }
- }
- accuracyGame()
- {
- for(int c=0;c<20;c++)
- {
- cout<<questions[c]<<endl;
- cin>>answer;
- if(answer==questionAnswers[c])
- {
- cout<<"That's correct!"<<endl;
- right++;
- }
- else
- {
- cout<<"That's incorrect!"<<endl;
- wrong++;
- }
- }
- cout<<"You've completed the quiz!"<<endl;
- cout<<"You had "<<right<<" many correct answers."<<endl;
- cout<<"You had "<<wrong<<" many incorrect answers."<<endl;
- }
- int quizMain()
- {
- do{
- cout<<"Programming Quiz!"<<endl;
- cout<<"-----------------\n"<<endl;
- system("cls");
- cout<<"1) Lives"<<endl;
- cout<<"2) Accuracy"<<endl;
- cout<<"3) Return to Menu"<<endl;
- cin>>choice;
- if(choice==1)livesChoice();
- else if(choice==2)accuracyChoice();
- else if(choice==3)break;
- wrong=0;
- right=0;
- lives=0;
- }while(true);
- }
Advertisement
Add Comment
Please, Sign In to add comment