1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
#include <iostream.h>
#include <windows.h>
#include <string.h>
int main()
{
int count;
char guess[30];
char name[30];
char password[30]= "Meow!";
int counter;
char restart; // variable for restart of test
int answer1int;
int answer2int;
char answer1chararray[30];
char answer1chararray_answer[30]= "Tails";
char answer2chararray[30];
char answer2chararray_answer[30]="Venus";
char answer1char;
char answer2char;
int correct = 0;
int incorrect = 0;
for(count=10; count >= 1; count--)
{
cout << count << endl;
Sleep(5);
}
cout<<"Please Enter Your Name: "<<endl;
cin.getline(name,30);
cout<<"Now Please Enter The Password"<<endl;
cin.getline(guess,30);
if((!strcmp (guess, password)))
{
cout<<"Gratz...";
}
else
{
// Compares 2 character arrays as long as they end in null \0 which char strings do, only returns boolean value.
while ((strcmp (guess, password) != 0) ) //hence why not equal is there, == does not work apparently.
{cout<<"Please Enter The Correct Password"<<endl;
cin>>guess;}
}
cout<<"Congratulations you guessed the password correctly!";
Sleep(500);
system("CLS");
cout<<"Hello and welcome to Credit Crunch Millionaire!!"<<endl;
cout<<"Please read the questions carefully and when prompted for an answer please";
cout<<" enter a number from 1-4 corresponding with which answer you choose, this is for the first two questions ONLY."<<endl;
cout<<"For questions 3-4 please write the answer out."<<endl;
cout<<"Finally for questions 5-6 please answer with A-D."<<endl;
Sleep(650);
system("CLS");
do{
cout<<"What is the vitamin name for absorbic acid?"<<endl;
cout<<"1) Vitamin A "<<endl;
cout<<"2) Vitamin B "<<endl;
cout<<"3) Vitamin C "<<endl; //right answer
cout<<"4) Vitamin D "<<endl;
cin>>answer1int;
system("CLS");
cout<<"Who is the current president of Nicaragua?"<<endl;
cout<<"1)Daniel Ortega"<<endl; //right answer
cout<<"2) Violeta Chamorro"<<endl;
cout<<"3)Adolfo Diaz"<<endl;
cout<<"4)Orlando Montenegro"<<endl;
cin>>answer2int;
system("CLS");
cout<<" NB. Type out the answer and start with a capital letter -Manx cats are famous for not having... "<<endl;
cin.getline(answer1chararray,30); //Tails
system("CLS");
cout<<" NB. Type out the answer and start with a capital letter.- Who is the greek goddess of love? "<<endl;
cin.getline(answer2chararray,30); //venus
system("CLS");
cout<<" NB. Type in the letter to answer- How many whiskers does the average cat have? "<<endl;
cout<<"A)6"<<endl;
cout<<"B)12"<<endl;
cout<<"C)16"<<endl;
cout<<"D)24"<<endl; //right answer
cin>>answer1char;
system("CLS");
cout<<"NB. Type in the letter to answer- Jehst is bigger than Dr.Dre, is this because he is: "<<endl;
cout<<" A)Richer"<<endl;
cout<<" B)Taller"<<endl;
cout<<" C)Lyrically better"<<endl;
cout<<" D)None of the above he is a nobody."<<endl; // right answer
cin>>answer2char;
system("CLS");
if (answer1int == 3)
{correct++;}
else
{incorrect++;}
if (answer2int == 1)
{correct++;}
else
{incorrect++;}
if ((!strcmp(answer1chararray,answer1chararray_answer)))
{correct++;}
else{incorrect++;}
if ((!strcmp(answer2chararray,answer2chararray_answer)))
{correct++;}
else
{incorrect++;}
if(answer1char == 'D' || 'd')
{correct++;}
else
{incorrect++;}
if(answer2char == 'D' || 'd')
{correct++}
else
{incorrect++;}
cout<< " You have got: " << correct << " correct and; " << incorrect << " incorrect "<<endl<<endl;
cout<<"Would you like to restart the quiz? Please enter Y/N";
cin>>restart;
}while(restart == 'y' || 'Y');
system("PAUSE");
return 0;
}
|