Geek Program in C++

Document Sample
Geek Program in C++ Powered By Docstoc
					#include #include #include #include #include #include

<iostream> <ostream> <string> <windows.h> <time.h> <ctime>

using namespace std; void centerstring(char* s) { int l=strlen(s); int pos=(int)((80-l)/2); for(int i=0;i<pos;i++) cout<<" "; cout<< s; } int main() { char quest[10]; char s; char response[100]; char name[100]; int score=0; int music; int x; system("color 0A"); cout<<"The" <<endl; cout<<"Geekiness" <<endl; cout<<"Test" <<endl; cout<<endl; Sleep(2500); cout<<"Please answer the following questions to determine the level of your geekiness.\n"; Sleep(2000); cout<<"First, do you know what 1337 stands for? (Yes/No)\n"; cin.getline(quest, 10); if (strcmp (quest, "Yes")==0) { score=score+5; std::cout<<"Great! Let's move on. " <<"Your geek score is now " <<score <<"." <<std::endl; } else { score=score+1; std::cout<<"GG. You are a n00b. " <<"Your geek score is now " <<score <<"." <<std::endl; } Sleep(2000); cout<<"How many music files do you own? (Enter a whole number.)\n";

cin>> music; if (music<=1000 && strcmp (quest, "Yes")==0) { score=score+1; std::cout<<"Doh, you are a music novice. Please try again. And don't talk to me. " <<"Your geek score is now " <<score <<"." <<std::endl; } if (music>1000 && music<=3000 && strcmp (quest, "Yes")==0) { score=score+2; std::cout<<"Good start. It could be better. Hence, you are a music dabbler. " <<"Your geek score is now " <<score <<"." <<std::endl; } if (music>3000 && music<=5000 && strcmp (quest, "Yes")==0) { score=score+3; std::cout<<"Hmm, I respect that. You are a music guru. " <<"Your geek score is now " <<score <<"." <<std::endl; } if (music>5000 && strcmp (quest, "Yes")==0) { score=score+5; std::cout<<"Beast! Nice collection mang. You are a music fanatic. " <<"Your geek score is now " <<score <<"." <<std::endl; } if (music<=1000 && strcmp (quest, "No")==0) { score=score+1; std::cout<<"Doh, you are a music novice. Please try again. And don't talk to me. " <<"Your geek score is now " <<score <<"." <<std::endl; } if (music>1000 && music<=3000 && strcmp (quest, "No")==0) { score=score+2; std::cout<<"Good start. It could be better. Hence, you are a music dabbler. " <<"Your geek score is now " <<score <<"." <<std::endl; } if (music>3000 && music<=5000 && strcmp (quest, "No")==0) { score=score+3; std::cout<<"Hmm, I respect that. You are a music guru. " <<"Your geek score is now " <<score <<"." <<std::endl; } if (music>5000 && strcmp (quest, "No")==0) { score=score+5; std::cout<<"Beast! Nice collection mang. That is 1337. Hope you know what that means by now because you are a 1337 music fanatic. " <<"Your geek score is now " <<score <<"." <<std::endl; } cin.get(); Sleep(2000); cout<<"Is the Rubik's Cube a piece of cake for you? (Yes/No)\n"; cin.getline(quest, 10); if (strcmp (quest, "Yes")==0) { cout<<"What is your fastest time in seconds? \n"; cin>> x; cin.ignore();

if (x<60) { score=score+5; std::cout<<"Beasssttt! Way to own that. " <<"Your geek score is now " <<score <<"." <<std::endl; } else { score=score+3; std::cout<<"Alright, alright, respectable. " <<"Your geek score is now " <<score <<"." <<std::endl; } } else { score=score+1; std::cout<<"It's okay. Not everyone can be awesome. " <<"Your geek score is now " <<score <<"." <<std::endl; } Sleep(2000); cout<<"Do you have a duct-taped wallet? (Yes/No)\n"; cin.getline(quest, 10); if (strcmp (quest, "Yes")==0) { score=score+5; std::cout<<"Ballinnnn'. " <<"Your geek score is now " <<score <<"." <<std::endl; } else { score=score+1; std::cout<<"You're missing out. " <<"Your geek score is now " <<score <<"." <<std::endl; } Sleep(2000); cout<<"Do you collect comic books? (Yes/No)\n"; cin.getline(quest, 10); if (strcmp(quest, "Yes")==0) { cout<<"How big is your comic book collection? (Enter a whole number.)\n"; cin>> x; if (x>10) { score=score+5; std::cout<<"Impressive. That's bigger than mine. " <<"Your geek score is now " <<score <<"." <<std::endl; } else { score=score+1; std::cout<<"Hmm, I'm sure you collect other things... " <<"Your geek score is now " <<score <<"." <<std::endl; } cin.get(); } else { score=score+1; std::cout<<"I'm sure you collect other things... " <<"Your geek score is now " <<score <<"." <<std::endl;

} Sleep(2000); cout<<"Are you a Star Wars fan? (Yes/No)\n"; cin.getline(quest, 10); if (strcmp( quest, "Yes")==0) { score=score+5; std::cout<<"May the force be with you, young grasshopper. " <<"Your geek score is now " <<score <<std::endl; } else { score=score+1; std::cout<<"Don't fall to the dark side now... " <<"Your geek score is now " <<score <<std::endl; } Sleep(2000); cout<<"What is the contrapositive of the converse of the implication 'If not x, then not y'? (Write a complete sentence.)\n"; cin.getline(response, 100); if (strcmp (response, "If x, then y.")==0) { score=score+5; std::cout<<"You make logic seem easy. " <<"Your geek score is now " <<score <<"." <<std::endl; } else { score=score+1; std::cout<<"Uhh...no. " <<"Your geek score is now " <<score <<"." <<std::endl; } Sleep(2000); cout<<"Okay, this one is for all the marbles (sort of). Do you have a geeky significant other? (Yes/No)\n"; cin.getline(quest, 10); if (strcmp (quest, "Yes")==0) { score=score+5; std::cout<<"Nice! Congrats! May all the geeks of the world find true l0v3. " <<"Your geek score is now " <<score <<"." <<std::endl; } else { score=score+1; std::cout<<"=( That's okay, you'll find the 0n3 someday. In the meanwhile, have a byte of this <3. " <<"Your geek score is now " <<score <<"." <<std::endl; } cout<<endl; cout<<"Press Enter for your total geek score. \n"; cin.get(); cout<<"Your total geek score is: " <<score <<".\n"; cout<<endl; cout<<"This means you are ... ";

Sleep(2000); if (score>0 && score<=10) cout<<"a n00b."; if (score>10 && score<=25) cout<<"a semi-geek."; if (score>25 && score<=35) cout<<"a pr0."; if (score>35 && score<40) cout<<"an uber-geek."; if (score==40) cout<<"my best friend."; cout<< endl; Sleep(2000); cout<< endl; cout<<"You took this test on "; struct tm *local; time_t t; t=time(NULL); local=localtime(&t); cout<< asctime(local); cout<< endl; cin.get(); system("color 09"); centerstring (&s); cout<<"P" <<endl; system("color 0C"); centerstring (&s); cout<<"E" <<endl; system("color 09"); centerstring (&s); cout<<"A" <<endl; system("color 0C"); centerstring (&s); cout<<"C" <<endl; system("color 09"); centerstring (&s); cout<<"E" <<endl; cout<< endl; system("color 0C"); centerstring (&s); cout<<"O" <<endl; system("color 09"); centerstring (&s); cout<<"U" <<endl; system("color 0C"); centerstring (&s); cout<<"T" <<endl; cout<< endl; system("color 0C"); centerstring (&s);

cout<<"<3"; cin.get(); }


				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:227
posted:5/19/2009
language:English
pages:6
Description: This text provides the C++ code needed to compile my Geek Test
About