From 13518867692453d116789f9d211dd909c53d98f5 Mon Sep 17 00:00:00 2001 From: AvaEN Date: Sat, 9 Jul 2016 12:55:52 -0400 Subject: [PATCH 1/7] AvaProjectProposal --- AvaFinalProject.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 AvaFinalProject.txt diff --git a/AvaFinalProject.txt b/AvaFinalProject.txt new file mode 100644 index 0000000..2921194 --- /dev/null +++ b/AvaFinalProject.txt @@ -0,0 +1,18 @@ +Ava N. +July 9, 2016 + +Final Project Proposal: + +For my final project, I would like to create a quiz show, similar to Jeopardy. The objective of the game is to answer as many questions, correctly, as possible. I am considering adding a time limit as well. + +The questions would be divided into different categories. For example, under the "computer science" category, the lowest, or '100' slot question might state: 'This device was used to solve math problems before the invention of electricity." The answer, which would not be case sensitive, would be inputed by the contestant/player. Also, I am deciding whether to require the player input to include "what is ..." before the answer. If I have time, I would like to make a 2, 3, or 4 player option as well. + +An example of a loop I would use is for the fill-in the answer section. If the correct answer is chosen, then the point goes to the player who asked the question (under a time limit). If that person does not answer correctly or under the time limit, it will go to the next player, and if that player answers correctly, then the original amount of points will get split in half. + +I am choosing this project because quiz shows and being part of one is so much fun, and even playing one that I create is so cool. I am excited to develop the game design and how I will arrange the 'answers' and the 'questions', and where I will put the timer, and arrange different color schemes. + +Libraries I will use are the include the ones we have used in class: stdio.h, string.h, math.h, etc. I plan to use the time.h library for the timer. For graphics, I may want to use Cairo, although I have never used that library before. + +This is my Final Project Proposal and I am excited to start working on it (once it is approved)! + + From f447e5a4eab7f294f9e9251949c1ee597138931c Mon Sep 17 00:00:00 2001 From: AvaEN Date: Sat, 9 Jul 2016 13:11:32 -0400 Subject: [PATCH 2/7] Update AvaFinalProject.txt --- AvaFinalProject.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/AvaFinalProject.txt b/AvaFinalProject.txt index 2921194..c3e4e3f 100644 --- a/AvaFinalProject.txt +++ b/AvaFinalProject.txt @@ -3,16 +3,14 @@ July 9, 2016 Final Project Proposal: -For my final project, I would like to create a quiz show, similar to Jeopardy. The objective of the game is to answer as many questions, correctly, as possible. I am considering adding a time limit as well. +For my final project, I would like to create a quiz show, similar to Jeopardy. The objective of the game is to answer as many questions correctly as possible. I will be adding a time limit as well. -The questions would be divided into different categories. For example, under the "computer science" category, the lowest, or '100' slot question might state: 'This device was used to solve math problems before the invention of electricity." The answer, which would not be case sensitive, would be inputed by the contestant/player. Also, I am deciding whether to require the player input to include "what is ..." before the answer. If I have time, I would like to make a 2, 3, or 4 player option as well. +The questions would be divided into different categories. For example, under the "computer science" category, the lowest, or '100' slot question might state: 'This device was used to solve math problems before the invention of electricity." The answer, which would not be case sensitive, would be inputed by the contestant/player. Also, I am deciding whether to require the player input to include "what is ..." before the answer. This game will be created for a single-player, but if I have time, I would like to make a 2, 3, or 4 player option as well. -An example of a loop I would use is for the fill-in the answer section. If the correct answer is chosen, then the point goes to the player who asked the question (under a time limit). If that person does not answer correctly or under the time limit, it will go to the next player, and if that player answers correctly, then the original amount of points will get split in half. +An example of a loop I would use is for the fill-in the answer section. If the correct answer is chosen, then the point goes to the player who asked the question (under a time limit). If that person does not answer correctly or under the time limit, it will go to the next player, and if that player answers correctly, then the original amount of points will get split in half. -I am choosing this project because quiz shows and being part of one is so much fun, and even playing one that I create is so cool. I am excited to develop the game design and how I will arrange the 'answers' and the 'questions', and where I will put the timer, and arrange different color schemes. +I am choosing this project because taking part in a quiz show or game is so much fun, and playing one that I create would be great. I am excited to develop the game design and decide how I will arrange the 'answers' and the 'questions', and where I will put the timer, and arrange different color schemes. Libraries I will use are the include the ones we have used in class: stdio.h, string.h, math.h, etc. I plan to use the time.h library for the timer. For graphics, I may want to use Cairo, although I have never used that library before. This is my Final Project Proposal and I am excited to start working on it (once it is approved)! - - From 7e2237c7def69c607a6e931cfa306d41864462e1 Mon Sep 17 00:00:00 2001 From: AvaEN Date: Sat, 9 Jul 2016 13:13:50 -0400 Subject: [PATCH 3/7] Update AvaFinalProject.txt --- AvaFinalProject.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AvaFinalProject.txt b/AvaFinalProject.txt index c3e4e3f..e506793 100644 --- a/AvaFinalProject.txt +++ b/AvaFinalProject.txt @@ -7,7 +7,7 @@ For my final project, I would like to create a quiz show, similar to Jeopardy. T The questions would be divided into different categories. For example, under the "computer science" category, the lowest, or '100' slot question might state: 'This device was used to solve math problems before the invention of electricity." The answer, which would not be case sensitive, would be inputed by the contestant/player. Also, I am deciding whether to require the player input to include "what is ..." before the answer. This game will be created for a single-player, but if I have time, I would like to make a 2, 3, or 4 player option as well. -An example of a loop I would use is for the fill-in the answer section. If the correct answer is chosen, then the point goes to the player who asked the question (under a time limit). If that person does not answer correctly or under the time limit, it will go to the next player, and if that player answers correctly, then the original amount of points will get split in half. +An example of a loop I would use is for the fill-in the answer section. If the correct answer is chosen, then the point goes to the player who asked the question (under a time limit). If that person does not answer correctly or under the time limit, it will go to the next player, and if that player answers correctly, then the original amount of points will get split in half. I will also use functions for the input of the contestant. I am choosing this project because taking part in a quiz show or game is so much fun, and playing one that I create would be great. I am excited to develop the game design and decide how I will arrange the 'answers' and the 'questions', and where I will put the timer, and arrange different color schemes. From 5c0a60bd2ec2d873c46f1e948a609185bbd05227 Mon Sep 17 00:00:00 2001 From: AvaEN Date: Fri, 15 Jul 2016 14:05:20 -0400 Subject: [PATCH 4/7] Final Project --- FinalProject/answer.txt | 16 ++ FinalProject/extra.c | 396 +++++++++++++++++++++++++++++++++++++ FinalProject/questions.txt | 16 ++ FinalProject/quiz_game | Bin 0 -> 13392 bytes FinalProject/quiz_game.c | 169 ++++++++++++++++ FinalProject/readme.txt | 25 +++ FinalProject/sam | Bin 0 -> 9056 bytes FinalProject/sample_doc.c | 59 ++++++ FinalProject/temp | Bin 0 -> 13384 bytes FinalProject/temp.c | 190 ++++++++++++++++++ 10 files changed, 871 insertions(+) create mode 100644 FinalProject/answer.txt create mode 100644 FinalProject/extra.c create mode 100644 FinalProject/questions.txt create mode 100755 FinalProject/quiz_game create mode 100644 FinalProject/quiz_game.c create mode 100644 FinalProject/readme.txt create mode 100755 FinalProject/sam create mode 100644 FinalProject/sample_doc.c create mode 100755 FinalProject/temp create mode 100644 FinalProject/temp.c diff --git a/FinalProject/answer.txt b/FinalProject/answer.txt new file mode 100644 index 0000000..469bc78 --- /dev/null +++ b/FinalProject/answer.txt @@ -0,0 +1,16 @@ +Army +Switzerland +Hyena +New York City +Mudd +Winter +700 +February +Whale +1492 +Abacus +Orange +P +Hydrogen +24 + diff --git a/FinalProject/extra.c b/FinalProject/extra.c new file mode 100644 index 0000000..439f222 --- /dev/null +++ b/FinalProject/extra.c @@ -0,0 +1,396 @@ +/* + switch(r1){ + case 1: + printf("\n\nWhich of the following is a Palindrome number?"); + printf("\n\nA.42042\t\tB.101010\n\nC.23232\t\tD.01234"); + + if (toupper(getchar())=='C'){ + printf("\n\nCorrect!!!");count++; + getchar(); + break; +} + else + { + printf("\n\nWrong!!! The correct answer is C.23232"); + getchar(); + break; + } + + case 2: + printf("\n\n\nThe country with the highest environmental performance index is..."); + printf("\n\nA.France\t\tB.Denmark\n\nC.Switzerland\t\tD.Finland"); + if (toupper(getchar())=='C') + {printf("\n\nCorrect!!!");count++; + getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is C.Switzerland"); + getchar(); + break;} + + case 3: + printf("\n\n\nWhich animal laughs like human being?"); + printf("\n\nA.Polar Bear\t\tB.Hyena\n\nC.Donkey\t\tD.Chimpanzee"); + if (toupper(getchar())=='B') + {printf("\n\nCorrect!!!");count++; + getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is B.Hyena"); + getchar(); + break;} + + case 4: + printf("\n\n\nWho was awarded the youngest player award in Fifa World Cup 2006?"); + printf("\n\nA.Wayne Rooney\t\tB.Lucas Podolski\n\nC.Lionel Messi\t\tD.Christiano Ronaldo"); + if (toupper(getchar())=='B') + {printf("\n\nCorrect!!!");count++; + getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is B.Lucas Podolski"); + getchar(); + break;} + + case 5: + printf("\n\n\nWhich is the third highest mountain in the world?"); + printf("\n\nA.Mt. K2\t\tB.Mt. Kanchanjungha\n\nC.Mt. Makalu\t\tD.Mt. Kilimanjaro"); + if (toupper(getchar())=='B') + {printf("\n\nCorrect!!!");count++; + getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is B.Mt. Kanchanjungha"); + getchar(); + break;} + + case 6: + printf("\n\n\nWhat is the group of frogs known as?"); + printf("\n\nA.A traffic\t\tB.A toddler\n\nC.A police\t\tD.An Army"); + if (toupper(getchar())=='D' ) + {printf("\n\nCorrect!!!");count++; + getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is D.An Army"); + getchar(); + break;}} + } + + if(count>=2) + {goto test;} + else + { + system("clear"); + printf("\n\nSORRY YOU ARE NOT ELIGIBLE TO PLAY THIS GAME, BETTER LUCK NEXT TIME"); + getchar(); + goto mainhome; + } + test: + system("clear"); + printf("\n\n\t*** CONGRATULATION %s you are eligible to play the Game ***",playername); + printf("\n\n\n\n\t!Press any key to Start the Game!"); + if(toupper(getchar())=='p') + {goto game;} +game: + countr=0; + for(i=1;i<=10;i++) + {system("clear"); + r=i; + + switch(r) + { + case 1: + printf("\n\nWhat is the National Game of England?"); + printf("\n\nA.Football\t\tB.Basketball\n\nC.Cricket\t\tD.Baseball"); + if (toupper(getchar())=='C') + {printf("\n\nCorrect!!!");countr++;getchar(); + break;getchar();} + else + {printf("\n\nWrong!!! The correct answer is C.Cricket");getchar(); + goto score; + break;} + + case 2: + printf("\n\n\nStudy of Earthquake is called............,"); + printf("\n\nA.Seismology\t\tB.Cosmology\n\nC.Orology\t\tD.Etimology"); + if (toupper(getchar())=='A') + {printf("\n\nCorrect!!!");countr++;getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is A.Seismology");getchar(); + goto score; + break; + } + + case 3: + printf("\n\n\nAmong the top 10 highest peaks in the world, how many lie in Nepal? "); + printf("\n\nA.6\t\tB.7\n\nC.8\t\tD.9"); + if (toupper(getchar())=='C') + {printf("\n\nCorrect!!!");countr++;getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is C.8");getchar(); + goto score; + break;} + + case 4: + printf("\n\n\nThe Laws of Electromagnetic Induction were given by?"); + printf("\n\nA.Faraday\t\tB.Tesla\n\nC.Maxwell\t\tD.Coulomb"); + if (toupper(getchar())=='A') + {printf("\n\nCorrect!!!");countr++;getchar(); + break;} + else + { + printf("\n\nWrong!!! The correct answer is A.Faraday");getchar(); + goto score; + break; + } + + case 5: + printf("\n\n\nIn what unit is electric power measured?"); + printf("\n\nA.Coulomb\t\tB.Watt\n\nC.Power\t\tD.Units"); + if (toupper(getchar())=='B') + {printf("\n\nCorrect!!!");countr++;getchar(); break;} + else + { + printf("\n\nWrong!!! The correct answer is B.Power"); + getchar(); + goto score; + break; + } + + case 6: + printf("\n\n\nWhich element is found in Vitamin B12?"); + printf("\n\nA.Zinc\t\tB.Cobalt\n\nC.Calcium\t\tD.Iron"); + if (toupper(getchar())=='B' ) + {printf("\n\nCorrect!!!");countr++;getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is B.Cobalt");goto score; + getchar(); + break;} + + case 7: + printf("\n\n\nWhat is the National Name of Japan?"); + printf("\n\nA.Polska\t\tB.Hellas\n\nC.Drukyul\t\tD.Nippon"); + if (toupper(getchar())=='D') + {printf("\n\nCorrect!!!");countr++;getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is D.Nippon");getchar(); + goto score; + break;} + + case 8: + printf("\n\n\nHow many times a piece of paper can be folded at the most?"); + printf("\n\nA.6\t\tB.7\n\nC.8\t\tD.Depends on the size of paper"); + if (toupper(getchar())=='B') + {printf("\n\nCorrect!!!");countr++;getchar(); break;} + else + {printf("\n\nWrong!!! The correct answer is B.7");getchar(); + goto score; + break;} + + case 9: + printf("\n\n\nWhat is the capital of Denmark?"); + printf("\n\nA.Copenhagen\t\tB.Helsinki\n\nC.Ajax\t\tD.Galatasaray"); + if (toupper(getchar())=='A') + {printf("\n\nCorrect!!!");countr++; getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is A.Copenhagen");getchar(); + goto score; + break;} + + case 10: + printf("\n\n\nWhich is the longest River in the world?"); + printf("\n\nA.Nile\t\tB.Koshi\n\nC.Ganga\t\tD.Amazon"); + if (toupper(getchar())=='A') + {printf("\n\nCorrect!!!");countr++;getchar(); break;} + else + {printf("\n\nWrong!!! The correct answer is A.Nile");getchar();break;goto score;} + + case 11: + printf("\n\n\nWhat is the color of the Black Box in aeroplanes?"); + printf("\n\nA.White\t\tB.Black\n\nC.Orange\t\tD.Red"); + if (toupper(getchar())=='C') + {printf("\n\nCorrect!!!");countr++;getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is C.Orange");getchar(); + break;goto score;} + + case 12: + printf("\n\n\nWhich city is known at 'The City of Seven Hills'?"); + printf("\n\nA.Rome\t\tB.Vactican City\n\nC.Madrid\t\tD.Berlin"); + if (toupper(getchar())=='A') + {printf("\n\nCorrect!!!");countr++;getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is A.Rome");getchar(); + break;goto score;} + + case 13: + printf("\n\n\nName the country where there no mosquitoes are found?"); + printf("\n\nA.Japan\t\tB.Italy\n\nC.Argentina\t\tD.France"); + if (toupper(getchar())=='D'){ + printf("\n\nCorrect!!!");countr++;getchar(); + break; + } + else{ + printf("\n\nWrong!!! The correct answer is D.France");getchar(); + break; + goto score; + } + + case 14: + printf("\n\n\nWho is the author of 'Pulpasa Cafe'?"); + printf("\n\nA.Narayan Wagle\t\tB.Lal Gopal Subedi\n\nC.B.P. Koirala\t\tD.Khagendra Sangraula"); + if (toupper(getchar())=='A'){ + printf("\n\nCorrect!!!"); + countr++; + getchar(); + break; + } + else{ + printf("\n\nWrong!!! The correct answer is A.Narayan Wagle"); + getchar(); + break; + goto score;} + + case 15: + printf("\n\n\nWhich Blood Group is known as the Universal Recipient?"); + printf("\n\nA.A\t\tB.AB\n\nC.B\t\tD.O"); + if (toupper(getchar())=='B'){ + printf("\n\nCorrect!!!"); + countr++; + getchar(); + break; + } + else{ + printf("\n\nWrong!!! The correct answer is B.AB"); + getchar(); + goto score; + break; + } + case 16: + printf("\n\n\nWhat is the unit of measurement of distance between Stars?"); + printf("\n\nA.Light Year\t\tB.Coulomb\n\nC.Nautical Mile\t\tD.Kilometer"); + if (toupper(getchar())=='A'){ + printf("\n\nCorrect!!!"); + countr++; + getchar(); + break; + } + else{ + printf("\n\nWrong!!! The correct answer is A.Light Year");getchar(); + goto score; + break; + } + + case 17: + printf("\n\n\nThe country famous for Samba Dance is........"); + printf("\n\nA.Brazil\t\tB.Venezuela\n\nC.Nigeria\t\tD.Bolivia"); + if (toupper(getchar())=='A'){ + printf("\n\nCorrect!!!"); + countr++; + getchar(); + break; + } + else{ + printf("\n\nWrong!!! The correct answer is A.Brazil");getchar();goto score; + break; + } + + case 18: + printf("\n\n\nWind speed is measure by__________?"); + printf("\n\nA.Lysimeter\t\tB.Air vane\n\nC.Hydrometer\t\tD.Anemometer\n\n"); + if (toupper(getchar())=='D'){ + printf("\n\nCorrect!!!"); + countr++; + getchar(); + break; + } + else{ + printf("\n\nWrong!!! The correct answer is D.Anemometer"); + getchar(); + goto score; + break; + } + + case 19: + printf("\n\n\nWhich city in the world is popularly known as The City of Temple?"); + printf("\n\nA.Delhi\tB.Bhaktapur\n\nC.Kathmandu\tD.Agra\n\n"); + if (toupper(getchar())=='C'){ + printf("\n\nCorrect!!!"); + countr++; + getchar(); + break; + } + else{ + printf("\n\nWrong!!! The correct answer is C.Kathmandu"); + getchar(); + goto score; + break; + } + + case 20: + printf("\n\n\nWhich hardware was used in the First Generation Computer?"); + printf("\n\nA.Transistor\t\tB.Valves\n\nC.I.C\t\tD.S.S.I"); + if (toupper(getchar())=='B'){ + printf("\n\nCorrect!!!"); + countr++; + getchar(); + break; + } + else{ + printf("\n\nWrong!!! The correct answer is B.Valves"); + getchar(); + goto score; + break; + } + + case 21: + printf("\n\n\nOzone plate is being destroyed regularly because of____ ?"); + printf("\n\nA.L.P.G\t\tB.Nitrogen\n\nC.Methane\t\tD. C.F.C"); + if (toupper(getchar())=='D') + {printf("\n\nCorrect!!!");countr++; getchar(); + break;} + else + {printf("\n\nWrong!!! The correct answer is D. C.F.C");getchar();goto score; + break;} + + case 22: + printf("\n\n\nWho won the Women's Australian Open Tennis in 2007?"); + printf("\n\nA.Martina Hingis\t\tB.Maria Sarapova\n\nC.Kim Clijster\t\tD.Serena Williams"); + if (toupper(getchar())=='D'){ + printf("\n\nCorrect!!!"); + countr++; + getchar(); + break; + } + + else{ + printf("\n\nWrong!!! The correct answer is D.Serena Williams"); + getchar(); + goto score; + break; + } + + case 23: + printf("\n\n\nWhich film was awarded the Best Motion Picture at Oscar in 2010?"); + printf("\n\nA.The Secret in their Eyes\t\tB.Shutter Island\n\nC.The King's Speech\t\tD.The Reader"); + if (toupper(getchar())=='C'){ + printf("\n\nCorrect!!!");countr++; getchar(); + break; + } + else{ + printf("\n\nWrong!!! The correct answer is C.The King's Speech"); + getchar(); + goto score; + break; + } + } +} +*/ diff --git a/FinalProject/questions.txt b/FinalProject/questions.txt new file mode 100644 index 0000000..069f8b5 --- /dev/null +++ b/FinalProject/questions.txt @@ -0,0 +1,16 @@ +1. What is a group of frogs known as? +2. What country has the highest environmental performance index? +3. Which animal laughs like human being? +4. In which city is manhattan located? +5. In which building is the Columbia HSP for Intro to Programming in C? +6. During what season do animals hybernate? +7. How much wood would a woodchuck chuck if a woodchuck could chuck wood (answer in pounds)? +8. In what month is Valentine's Day? +10. Which underwater creature is bigger: Dolphin or Whale? +11. In what year did Christopher Columbus sail the ocean blue? +12. This device was used to solve math problems before the invention of electricity. +13. What color comes after red in the rainbow? +14. What is the 16th letter in the alphabet? +15. What is the first element in the periodic table (not in scientific notation)? +16. How many students are in the Intro to Programming in C class? + diff --git a/FinalProject/quiz_game b/FinalProject/quiz_game new file mode 100755 index 0000000000000000000000000000000000000000..f2424b864dc37461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)EyXMtoq1;fP9qk6Svy%4e96qX9*?tznH!~{~ zX>6&rqdki2N#{e|`6Mo1CgUtbTyHej%R=#?H0()gXJyG5E1ScqzK1bUmbFq*Qc$`6 zl+8lIVIgEgJsGez4&GUaCK!Y=B9KB>ubNW5aTw8@RF!i}YUuozVh}?$(Y|C1ZOGVU z9tcHc2qVKnnC18+XBSxOeiew`lkijI{66dVe|^tb?=!V+l69y1z|h_f%biGipP=vY za)oQ6e?K%|kBnPi?;(pj!Zx!ASN_$_e zKUEqAhwl^$IIlWP`)A5(eY^pSbR17C>5jhM$DC9R)%$BHEp6yL(I@ands|(<-tUwy zlTx3S#M#d~atc2UN_%CE>wQs;(yvo;{`M=F(R(a4RqN~h(@CXoC_%+8>HpJ8zfsBQ zebxn~pw9=0C7=2I_dGE2t3IF5`>{6_pwB%ZB9d~eX4x2WZhdFpMnQ#iT|5^bl`5<0 z?}B&h>;2tzrLWtoE%^Cw`tG!m-($Dzn_qSi}GZyvry?K3~{tLQdMg8^5{m7!e-lxuOlnNWEajxXA|233RQ)v!S z()$j5zuqtJ=U<1;TKs8!z3;73|Np=*@8^FEU23A%*ZX7s3H9HCF1c9i>wUET{}1~A zIp|@~_3QXM@2g+$x97K_07=VBZjsmc&rslQKjWvQD3@ed66dM)G@VC@TVL-lhPhPH z?bHUep5|{OLzwRW1y%n9mlAc7I8OyTd;pbG{eC&E|DYo&GbBq%({;$}x-C@JXQBE})=2%&_zL~?{|~e$K63y7 literal 0 HcmV?d00001 diff --git a/FinalProject/quiz_game.c b/FinalProject/quiz_game.c new file mode 100644 index 0000000..2c47435 --- /dev/null +++ b/FinalProject/quiz_game.c @@ -0,0 +1,169 @@ +//Ava N.'s + +//REAL VERSION -- Ava's Quiz Show +//Columbia HSP FInal Project +//Intro to Programming in C +//Due: July 15, 2016 + +#include +#include +#include +#include + + +void help(){ //gives instructions of the game + system("clear"); + printf("\n\n Instructions:"); + printf("\n ------------------------------------------------------"); + printf("\n ................... Ava's Quiz Show ...................."); + printf("\n >> You have to be able to answer 16 questions correctly."); + printf("\n >> All of the questions require fill-in answers."); + printf("\n >> This game is case-sensitive, so all answers have to"); + printf("\n have the first letter of each word uppercase."); + printf("\n >> If the question asks for a number, answer with a number."); + printf("\n >> The maximum number of points a you can get is 11."); + + printf("\n >> You will not be penalized for incorrect answers."); + + printf("\n\n\t**************Good Luck*******************\n\n"); + printf("\n\n\t Press 'enter' to continue to the main menu\n"); +} + + + +//start of the game show +int main(void){ + + system("clear"); + char filename[] = "questions.txt"; //opens the questions + char answersFile[]= "answer.txt"; //opens the answers + char ques_arr[1000]; //questions array + char ans_arr[100]; //answers array + char guess[100]; //the contestant's guess + FILE *questions = fopen(filename, "r"); + FILE *answers = fopen(answersFile, "r"); + int i; //variable for loop that checks contestants answers + int e; //variable for going through the questions.txt file + const int num_ques=15; //includes number of questions + char choice; //main menu variable + int countr = 0; //score + + mainhome: + system("clear"); //source: http://stackoverflow.com/questions/15102976/how-to-clear-screen-from-simple-c-program + //printf("\t\t\tC PROGRAM QUIZ GAME\n"); + printf("\n\t\t________________________________________"); + + printf("\n\t\t\t * WELCOME *"); + printf("\n\t\t\t * to *"); + printf("\n\t\t\t * AVA'S GAME SHOW *"); + printf("\n\t\t ____*_*_*_*_*_*_*_*_*_*_*_*____"); + printf("\n\t\t________________________________________"); + printf("\n\t\t\t BECOME THE CHAMPION!!! ") ; + printf("\n\t\t________________________________________"); + printf("\n\t\t________________________________________"); + printf("\n\t\t > Press S to start the game"); + printf("\n\t\t > press H for help "); + printf("\n\t\t > press Q to quit "); + printf("\n\t\t________________________________________\n\n"); + + + printf("\n\n\t\tAnswers must all begin with an uppercase letter\n\n\n"); +//MAIN MENU SELECTION OPTIONS + choice=toupper(getchar()); + printf("you entered %c\n",choice); + + if (toupper(getchar())=='S') + goto home; + else if (choice=='H'){ + printf("you typed in H"); + help(); + getchar(); + goto mainhome; + } + else if (choice=='Q'){ + printf("you typed in Q"); + exit(1); + + } + + + home: +//HAVING QUESTIONS PRINT ONE AT A TIME + for (e=0; e < num_ques; e++) //loop to go through each question in text file + { + //printf("\nQuestion:"); + printf("\n***Type in your answer to the following question:\n\n"); + + if(fgets(ques_arr, sizeof(ques_arr), questions)!= NULL) + { + printf("%s\n", ques_arr); + } + +//source: http://stackoverflow.com/questions/8328464/compare-user-input-with-text-file-in-c + + if (fgets(ans_arr, sizeof(ans_arr), answers) == NULL) + { + fprintf(stderr,"Error while reading file\n"); + return -1; + } + + + + for (i=0; i < 1; i++) + { + // printf("%d\n",i); + //fprintf(stderr,"DIAGNOSTIC -- the answer: %s\n", ans_arr); + //printf("DIAGNOSTIC -- GUESS variable is:%s\n", guess); + fgets(guess, sizeof(guess), stdin); + + //fprintf(stderr,"you answered %s\n",guess); + + if (strcmp(ans_arr, guess) == 0) + { + printf("Your guess was correct\n\n"); + countr++; + } + else if (guess!=ans_arr) + { + printf("Your guess was incorrect.\n\n\n"); + } + else + { + printf("You ran out of questions."); + } + } + } + + + fclose(questions); + fclose(answers); + +//SHOWING THE CONTESTANT THEIR SCORE - HOW MANY QUESTIONS THEY GOT CORRECT + score: + system("clear"); + //score=countr; + //printf("* DIAGNOSTIC -- countr is %d\n",countr); + //printf("* DIAGNOSTIC -- score is %d\n",score); + if(countr>0 && countr<=10){ + printf("\n\n\t\t************* CONGRATULATIONS **************"); + printf("\n\t You won %d points! \n", countr); + } + + else if(countr==11){ //highest score possible + printf("\n\n\n \t\t*********** Nice Job!! ***********"); + printf("\n\t\t\t\t You are the champion!!!!!!!!!"); + printf("\n\t\t\t You won %d points! \n",countr); + printf("\t\t Thank You!!"); + } + else{ + printf("\n\n\t******** You did not win any points ********"); + printf("\n\t\t Thanks for playing!. \n"); + printf("\n\t\t Better luck next time! \n"); + } + + + + return 0; + + + } diff --git a/FinalProject/readme.txt b/FinalProject/readme.txt new file mode 100644 index 0000000..97fa19f --- /dev/null +++ b/FinalProject/readme.txt @@ -0,0 +1,25 @@ +Ava N. +July 15, 2016 +Ava's Quiz Game + +This is a quiz show game programmed in C during Columbia HSP. My project takes questions from 'questions.txt' and answers from 'answer.txt' to these questions. There is a 'help'center, a 'quit' command, and a command to start the game. All instructions of how to play the game are inside of the game. This is a one player game. + + + +In my final proposal, I mentioned including a timer, however, I decided in the end not to do so. I also stated in my intro that I would have different slots for different categories with different point systems. I later decided that I would not have different categories but a list of questions that 'Ava's Quiz Game' would go through. Although I did not have time to include graphics, I created a fun looking 'main menu'! + + +I got my idea of how to set up Ava's Quiz Show here: http://www.codewithc.com/quiz-game-mini-project-in-c/ + + + +Files used in Ava's Quiz Show: [quiz_game.c], [questions.txt], and [answers.txt]. All other files were used to test the code. + + +I hope you enjoy Ava's Quiz Show! + + + +compile statement: + gcc quiz_game.c -o quiz_game + ./quiz_game diff --git a/FinalProject/sam b/FinalProject/sam new file mode 100755 index 0000000000000000000000000000000000000000..96a30e8a5d40351f8b9e7ca232c088827ca0c7b8 GIT binary patch literal 9056 zcmeHNeQaCR6~DIg)wDQnM8S34rx<`v?g6QLZ_jXP3)6R3=NbN*uuvk`)IS@x$hq5 z`PG)#ANyz8sr=48zw>eLJ@4N8?!D>fyLvWzJs!d26`v9$O;?2^WIu(NTq8w=wTWdS zB-V=SL=})q{6bPg+%7R+P@$REC_5i`1%7Q_8))-}WP$m0HjEl<;uaF8`j#l9iZ<_A zVT;U#&?G>9)YgDsir{^+z`RejV^VSUBa!?XlwX7LV}4#Wj5+s@`bNKA6|dJDf<$tN znCO(xB~G?P+h4O{RMwVD5j-Rd%v)_(FlWDe;79HJuoO^+J5+t;@-nab$6Sfx)?}i8 zW9zNSSYtAg$`3aVw{2|P*c!~GgDtY(6rXIjY}+Mk;yh}QsLfa6M`M8WRi8U^=z|ZM zhwu67%I6=r=Y_{|hhEr6_LKsOA^YXg#E1|wn}o-AMFO|IGr_|HNHML1xT+YE()u#^ zRb}w|%HWM<@a<)Ay$qfJuHok<>SL+)hs)p}2fk8VD@Fo+C<(#ia1+XePr7h{_ZOwt zwNb>=88am^c`GLjBWFdT4;sCfC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7XvOn+p7t{fg&zrWj9fQln_u@xqJ@)7G!C}==J_lDSC$?k$AaFW6 zvdrg*N#)<9{M_wVu%LY(nX*5hH_j`6T^Vxy?*2cb{M(fspG)eM1AT{yNTi&({V6|` zS85*-pI_#cKlk6(+HK`B@p1f|{(Q~}sDP7XHj)>=~c5opF8>g1MuJd)o>`ZhsWOuSN;6=$pz{Z z$lYF+ng10w&h`u5@2U#=D2RjDkNE<0PJiCl_bGpFCx>7^mM@_|825if)t^z0O>C&R z=8}D=oa%SmvHz_ud$J{BPJhSex}`!r9#;zoo#&k75@j5oJ5IYv)qYJ~9> literal 0 HcmV?d00001 diff --git a/FinalProject/sample_doc.c b/FinalProject/sample_doc.c new file mode 100644 index 0000000..9187e89 --- /dev/null +++ b/FinalProject/sample_doc.c @@ -0,0 +1,59 @@ +//This is for checking the code of the question-answer section in quiz_game code + +#include +#include + +int main (void){ + char filename[] = "questions.txt"; //opens the questions + char answersFile[]= "answer.txt"; //opens the answers + char ques_arr[1000]; //questions array + char ans_arr[100]; //answers array + char guess[25]; //the contestant's guess + FILE *questions = fopen(filename, "r"); + FILE *answers = fopen(answersFile, "r"); + int i; + int e; + const int num_ques=5; + for (e=0; e < num_ques; e++){ + + printf("Type in your answer to the following question:\n"); + + if(fgets(ques_arr, sizeof(ques_arr), questions)!= NULL){ //read 1 line from file + printf("%s\n", ques_arr); + } + + //source: http://stackoverflow.com/questions/8328464/compare-user-input-with-text-file-in-c + if (fgets(ans_arr, sizeof(ans_arr), answers) == NULL){ + fprintf(stderr,"Error while reading file\n"); + return -1; + } + + for (i=0; i < 1; i++){ //Loop for questions asking + //printf("%d\n",i); + //fprintf(stderr,"the answer: %s\n", ans_arr); + //printf("Please guess the word: \n"); + fgets(guess, sizeof(guess), stdin); + + fprintf(stderr,"you answered %s\n",guess); + if (strcmp(ans_arr, guess) == 0){ + printf("Your guess was correct\n\n"); + //continue; + } + else if (guess!=ans_arr){ + printf("Your guess was incorrect.\n\n\n"); + //continue; + } + else { + printf("You ran out of questions"); + //break; + } + } + } + + + fclose(questions); + fclose(answers); + return 0; +} + + diff --git a/FinalProject/temp b/FinalProject/temp new file mode 100755 index 0000000000000000000000000000000000000000..99393eb18436a5be724bd3c729c0f0bcd59d9f8e GIT binary patch literal 13384 zcmeHOeQX@ZbszGm4^q;R`m!b2u!gY}F{*SHWl5#w58d%YS{f8diIl`NrjN(FJ@TyM z-Q{jiB!$9ZLeUUGD6N|UpQklKlTynSK^O+i1RApY=kipP2!`+LsbvIH=)x5 zjI$gDT<4?&x~mA^R)oK&2;W_V-&2H77vUc+!k;R_A1uP31<E_59V#bH$uK2n6I z+kY+F!Y=V1)ELuwegbvkr(HZleuOC<_A_%RX0d28WhPiEYh_q4n6X0PQ^9cmsbDk| zi?fUsiJ>hWOIT4B?K7c+L%2VbW>zwrN||XE4abuilQhkAnq`JFmN~$pgXx$>WI8;M zf?Mj6e5bA8KnNa#!M=fHLNP&hxTU$iA-Ko4*RJjH?W1!k75_X+N~BprR7xNz7xjI! zAr@Oh8T`EBvRh*1Wb+~^quk!wBP8W6#ab5~KbpfRk9E=UBVPAGZJShFSD;S)>%#MR zIYQY|lgE3sGUV<&p6)+g>hk#fdDWlC=g%uf9#3P^r9F?=xj}7Rc{~DSm!3Sn!e$xk z&*N9;@u@r>fw#+09`ChT#*ERQuQVo>ZQRV6F*a>2o4N(*y2lx-hw0;bR}%nJM-VG8-ew7~BW_7Hwq;I{}%!`BI30-S%2YO_@P5^9s(*J$X* z7k@sBjEWc&W!q{f^y5vpYp3N2O+d}K{Q0bzv0}-DF+P_1uUu|sYzW7U&l-x(jQuvM z7Ben~5}83W?X#fM0}3tu5JT4Wv8N%KabB2S$)R&&d}jW4$np4CJKE4h7IxF1Z0Z6x zGiKmO={Pgih#Doq^|1q}4a@P}_%%+bWGznUn^fC`nhgD01PvShh+w}BzeDhx4gZSZ zOE&yE!9`au5PZ{aJ?Cs4cEYC#vUPeGpCia^*h0{-;bR0-fb+L-O7jUogys#@&y78T zW91b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zFwKdg*9Ut4E?2x3`gcR)T2%7w^*VxnSExK7g?)6}H=^YOtO0fZ7fby@_o5*t{Xh)s6Cv0|b;7i6rmD8bldmWzaKuz@+w1j9ml~*ES4(Z_L)S?@ zg+E%;>i+dQr*xUr`jiy*I^Nb({3%FUBWqr-hia7lZl&iQzoHpEztT{(y`g`J_Z_lTj#bx5j^i)i-d?X! zQlZR=>vdwIS8C|@ zAzELhm4=M+i^i|7pME}TSM~>8{kzBiO_#miFR%B}KWg_REAIZMT=sf>I=eyYZ=k{D z6?gyNLmLg1?jb6Ay`lHjyY=1p$FQlypSIWQ-A(HM9k}(~_$RQXA!>WQF6N)m{%5eI z5NmtAe%Al*LI3{-eHnEBI{z-Z`q%61+gs6qqV*+O#G3z4G~|z;@gAwlr5KUIK59EH zZ=)sOUau=gxHQq@)DE +#include +#include +#include + + +void help(){ //gives instructions of the game + system("clear"); + printf("\n\n Instructions:"); + printf("\n ------------------------------------------------------"); + printf("\n ................... Ava's Quiz Show ...................."); + printf("\n >> You have to be able to answer 11 questions."); + printf("\n >> All of the questions require fill-in answers."); + printf("\n >> This game is NOT case sensative, so all answers have to"); + printf("\n have the beginning of words be uppercase."); + printf("\n >> If the question asks for a number, answer with a number"); + printf("\n >> The maximum number of points a you can get is 11."); + + printf("\n >> You will not be penalized for getting answers incorrect"); + + printf("\n\n\t**************Good Luck*******************\n\n"); + printf("\n\n\t Press 'enter' to continue to the main menu\n"); +} + + + +//start of the game show +int main(void){ + + system("clear"); + char filename[] = "questions.txt"; //opens the questions + char answersFile[]= "answer.txt"; //opens the answers + char ques_arr[1000]; //questions array + char ans_arr[100]; //answers array + char guess[25]; //the contestant's guess + FILE *questions = fopen(filename, "r"); + FILE *answers = fopen(answersFile, "r"); + int i; + int e; + const int num_ques=10; + int score; + char choice; + int countr =0; + char userinput[20]; + char playername[20]; + char loop='y'; + //while (loop == 'y'); + mainhome: + system("clear"); //source: stackoverflow.com + printf("\t\t\tC PROGRAM QUIZ GAME\n"); + printf("\n\t\t________________________________________"); + + printf("\n\t\t\t * WELCOME *"); + printf("\n\t\t\t * to *"); + printf("\n\t\t\t * AVA'S GAME SHOW *"); + printf("\n\t\t ____*_*_*_*_*_*_*_*_*_*_*_*____"); + printf("\n\t\t________________________________________"); + printf("\n\t\t\t BECOME THE CHAMPION!!! ") ; + printf("\n\t\t________________________________________"); + printf("\n\t\t________________________________________"); + printf("\n\t\t > Press S to start the game"); + printf("\n\t\t > press H for help "); + printf("\n\t\t > press Q to quit "); + printf("\n\t\t________________________________________\n\n"); + + + + //printf("\n\n\n Press Y to start the game!\n"); + choice=toupper(getchar()); + printf("you entered %c\n",choice); + + if (toupper(getchar())=='S') + goto home; + else if (choice=='H'){ + printf("you typed in H"); + help(); + getchar(); + goto mainhome; + } + else if (choice=='Q'){ + printf("you typed in Q"); + exit(1); + + } + home: + +//HAVING QUESTIONS PRINT ONE AT A TIME + + + for (e=0; e < num_ques; e++) //loop to go through each question in the text file + { + //printf("\nQuestion:"); + printf("\n***Type in your answer to the following question:\n\n"); + + if(fgets(ques_arr, sizeof(ques_arr), questions)!= NULL) + { + printf("%s\n", ques_arr); + } + +//source: http://stackoverflow.com/questions/8328464/compare-user-input-with-text-file-in-c + + if (fgets(ans_arr, sizeof(ans_arr), answers) == NULL) + { + fprintf(stderr,"Error while reading file\n"); + return -1; + } + + + + for (i=0; i < 1; i++) + { + // printf("%d\n",i); + //fprintf(stderr,"DIAGNOSTIC -- the answer: %s\n", ans_arr); + //printf("DIAGNOSTIC -- GUESS variable is:%s\n", guess); + fgets(guess, sizeof(guess), stdin); + + //fprintf(stderr,"you answered %s\n",guess); + + if (strcmp(ans_arr, guess) == 0) + { + printf("Your guess was correct\n\n"); + countr++; + //continue; + } + else if (guess!=ans_arr) + { + printf("Your guess was incorrect.\n\n\n"); + //continue; + } + else + { + printf("You ran out of questions."); + //break; + } + } + } + + + fclose(questions); + fclose(answers); + //return 0; + + + score: + system("clear"); + score=countr; + //printf("* DIAGNOSTIC -- countr is %d\n",countr); + //printf("* DIAGNOSTIC -- score is %d\n",score); + if(score>0 && score<=10){ + printf("\n\n\t\t************* CONGRATULATIONS **************"); + printf("\n\t You won %d points! \n",score);goto go;} + + else if(score==11){ //highest score possible + printf("\n\n\n \t\t*********** Nice Job!! ***********"); + printf("\n\t\t\t\t You are the champion!!!!!!!!!"); + printf("\n\t\t\t You won %d points! \n",score); + printf("\t\t Thank You!!"); + } + else{ + printf("\n\n\t******** You did not win any points ********"); + printf("\n\t\t Thanks for playing!. \n"); + printf("\n\t\t Better luck next time! \n");goto + go; + } + + go: + //puts("\n\n Press Y if you want to play again"); + //puts("Play again next time!\n"); + //printf("Do you want to play again? (y/n)"); //source: my Assignment 4 hangman.c + //scanf("%c", &loop); + //if (loop != 'y') + //loop; 'n'; + + return 0; + if (toupper(getchar())=='Y') + goto mainhome; + /*else{ + edit_score(score,playername); + goto mainhome; + }*/ + } +//} +//}//this was put here after the cases were commented out. +//} From 76fc2f020f2b18080006b9f1c1e71006271aff0f Mon Sep 17 00:00:00 2001 From: AvaEN Date: Fri, 15 Jul 2016 15:31:13 -0400 Subject: [PATCH 5/7] Final Project 2 --- FinalProject/answer.txt | 16 +++++++++++++++- FinalProject/questions.txt | 20 +++++++++++++++++--- FinalProject/quiz_game | Bin 13392 -> 13392 bytes FinalProject/quiz_game.c | 15 ++++++++------- FinalProject/readme.txt | 11 ++++++++--- 5 files changed, 48 insertions(+), 14 deletions(-) diff --git a/FinalProject/answer.txt b/FinalProject/answer.txt index 469bc78..e3d6b2f 100644 --- a/FinalProject/answer.txt +++ b/FinalProject/answer.txt @@ -6,6 +6,7 @@ Mudd Winter 700 February +Bonjour Whale 1492 Abacus @@ -13,4 +14,17 @@ Orange P Hydrogen 24 - +Nile River +Mount Everest +Elvis Presley +Damascus +Sicily +Venezuela +Retriever +1984 +Theodore Roosevelt +6 +1509 +Queue +Ada Lovelace +Yes diff --git a/FinalProject/questions.txt b/FinalProject/questions.txt index 069f8b5..c588520 100644 --- a/FinalProject/questions.txt +++ b/FinalProject/questions.txt @@ -6,11 +6,25 @@ 6. During what season do animals hybernate? 7. How much wood would a woodchuck chuck if a woodchuck could chuck wood (answer in pounds)? 8. In what month is Valentine's Day? +9. How do you say 'Hello/Good morning' in french? 10. Which underwater creature is bigger: Dolphin or Whale? 11. In what year did Christopher Columbus sail the ocean blue? -12. This device was used to solve math problems before the invention of electricity. +12. What device was used to solve math problems before the invention of electricity? 13. What color comes after red in the rainbow? 14. What is the 16th letter in the alphabet? 15. What is the first element in the periodic table (not in scientific notation)? -16. How many students are in the Intro to Programming in C class? - +16. How many students are in the Introduction to Programming in C class? +17. What is the longest river in the world? (include 'River' at the end of answer) +18. What is the highest mountain in the world? +19. Who is known for being the King of Rock 'n Roll? +20. What is the world's oldest city? +21. What is the largest island in the Mediterranean sea? +22. In what country is the highest waterfall in the world? +23. What is the most popoular breed of dog? +24. In which year was the first computer sold with a mouse? +25. Who was the youngest President in the United States? +26. How many legs do butterflies have? +27. In which year did Henry VIII become King of England? +28. What is a linear data structure in which elements are added on one end and removed from the other? +29. Which female mathematician developed the first algorithm for the Analytical Machine? +30. Did you enjoy playing? (Yes/No) diff --git a/FinalProject/quiz_game b/FinalProject/quiz_game index f2424b864dc37461652f6c6409ef3813523514bb..a480b2617e0cdb1e6c87924dd34fadf6ffedf17e 100755 GIT binary patch delta 1307 zcmY+E`%6<%9Ki3{tlc>udw5+DoAa?;&uwHx{ZJeBxQ2<*>;XMADrbdQmOW{aEm|h6 z4utgwltF~D9~8naCbaq`MpP6PEl9XxWu=6bcKd$s%~PEp?)UrozRvl6&*7%Rsc<}H zEX(KARd)HMWJ%{~kj@LJN}Apxuk!Nm{uq3^qvpm)sN~MtSA{KxCpWE$4&B~qe05HM z6O;XEn#sS5gaPEOzZ6Ak0<9Md$lDM*7*-*^V7LNtM($Lw4{jac>L8{j0C}K6k_lQjlpCQH>K0xeZ*n{}DR3~DZd9O`u z`Okgf|L7Blymjgv`w=}1w;@(DtU^2rC}*J7Nu8z=@`je1Jme$YZ<E=p?w3(a(QIF?^U-W-VQ{9b>M5tyLWo87`Ju&=dg^jM9e_ zjXjX!VAG~`Lyg5Mq_s~icIpi6&JrT8;Znsm?GE5dmScgoD6bYs%3eTi`m3-&pL!#w z{F>s3c%)9YLm33Lsi%RBUox`;%)gh%6E;?d8ZRbMa-LAUE<|Dfgx{lN}FLSw@Ghxvd+hU#3NN?L_(TBFNIj*mYavt_I zk1EP$kkiK$r3+*~$P`Ep&i5Ha6CKQ(N4ls*@RB$U3Z?(weZ)#h5O+;rsFs(mjmgR(t6@g94qbN$xiC` qd5xhzp&{DfTVk0?tj*C9BeWZ0{{G>Hd`mK2LO^xGDdzfT>wg1rB_J;V delta 1279 zcmY+EYitZr6vyXwm)-8xzPBo&Rl2%f+1aR;2xe6nNlArzBqao)2qi>C(rv62tF6}w zitpl?tn3H~iq<%1#$McH=bYcU|8wrW=gv;|w(f1Gx^vC> zfA zpevi)GmN-_;}gO*M74#y2XHQT5|g1Lw`SZojLL~F^$bqPiMa3+O>5kR=FT@4glwau zPCQ9heDH^+(U}zeoS%oVjNr~L_k~d8_?EDm<72{lj`s;qalB3Vx6~EFG@rdNwD!O0 zJY0_9-n~YKeg7im0iPL5#RoZ#`Zs?p{tJw<1K&|q!SNkp??gp50y_jj zeL{i;WVMAnAn!1Gdb-@aba1mgBQFrd#_k)TCUD~6J!er9q7YdfSrtiWk($WLs@A|f z*La~uZksB!T|;I`T`aNwn!jJM_hN-DgLgtB L<4a8mPcr=m`2`$v diff --git a/FinalProject/quiz_game.c b/FinalProject/quiz_game.c index 2c47435..fea92ad 100644 --- a/FinalProject/quiz_game.c +++ b/FinalProject/quiz_game.c @@ -16,7 +16,7 @@ void help(){ //gives instructions of the game printf("\n\n Instructions:"); printf("\n ------------------------------------------------------"); printf("\n ................... Ava's Quiz Show ...................."); - printf("\n >> You have to be able to answer 16 questions correctly."); + printf("\n >> You have to be able to answer 30 questions correctly."); printf("\n >> All of the questions require fill-in answers."); printf("\n >> This game is case-sensitive, so all answers have to"); printf("\n have the first letter of each word uppercase."); @@ -44,7 +44,7 @@ int main(void){ FILE *answers = fopen(answersFile, "r"); int i; //variable for loop that checks contestants answers int e; //variable for going through the questions.txt file - const int num_ques=15; //includes number of questions + const int num_ques=29; //includes number of questions char choice; //main menu variable int countr = 0; //score @@ -67,7 +67,7 @@ int main(void){ printf("\n\t\t________________________________________\n\n"); - printf("\n\n\t\tAnswers must all begin with an uppercase letter\n\n\n"); + printf("\n\n\tAnswers must all begin with an uppercase letter\n\n\n"); //MAIN MENU SELECTION OPTIONS choice=toupper(getchar()); printf("you entered %c\n",choice); @@ -125,7 +125,8 @@ int main(void){ } else if (guess!=ans_arr) { - printf("Your guess was incorrect.\n\n\n"); + printf("Your guess was incorrect.\n"); + printf("The answer was: %s\n\n\n\n", ans_arr); } else { @@ -144,12 +145,12 @@ int main(void){ //score=countr; //printf("* DIAGNOSTIC -- countr is %d\n",countr); //printf("* DIAGNOSTIC -- score is %d\n",score); - if(countr>0 && countr<=10){ + if(countr>0 && countr<=29){ printf("\n\n\t\t************* CONGRATULATIONS **************"); - printf("\n\t You won %d points! \n", countr); + printf("\n\t\t\t You won %d points! \n", countr); } - else if(countr==11){ //highest score possible + else if(countr==30){ //highest score possible printf("\n\n\n \t\t*********** Nice Job!! ***********"); printf("\n\t\t\t\t You are the champion!!!!!!!!!"); printf("\n\t\t\t You won %d points! \n",countr); diff --git a/FinalProject/readme.txt b/FinalProject/readme.txt index 97fa19f..0fe102f 100644 --- a/FinalProject/readme.txt +++ b/FinalProject/readme.txt @@ -2,18 +2,19 @@ Ava N. July 15, 2016 Ava's Quiz Game -This is a quiz show game programmed in C during Columbia HSP. My project takes questions from 'questions.txt' and answers from 'answer.txt' to these questions. There is a 'help'center, a 'quit' command, and a command to start the game. All instructions of how to play the game are inside of the game. This is a one player game. +This is a quiz show game programmed in C during Columbia HSP. My project takes questions from 'questions.txt' and answers from 'answer.txt' to these questions. There is a 'help' center, a 'quit' command, and a command to start the game. All instructions of how to play the game are inside of the game. This is a one player game. +In my proposal, I mentioned including a timer; however, I decided in the end not to add one. I also stated in my introduction that I would have different slots for different categories with different point systems. I later decided that I would not have different categories but a list of questions that players of 'Ava's Quiz Game' would need to answer. Although I did not have time to include graphics, I created a fun looking 'main menu'! -In my final proposal, I mentioned including a timer, however, I decided in the end not to do so. I also stated in my intro that I would have different slots for different categories with different point systems. I later decided that I would not have different categories but a list of questions that 'Ava's Quiz Game' would go through. Although I did not have time to include graphics, I created a fun looking 'main menu'! +All of the answers to the questions, if you want to beat the game, is in answer.txt . If you want to view the question and the answer at the same time, go to line -- and uncomment it. (but I recommend playing without looking at the answers first!) I got my idea of how to set up Ava's Quiz Show here: http://www.codewithc.com/quiz-game-mini-project-in-c/ -Files used in Ava's Quiz Show: [quiz_game.c], [questions.txt], and [answers.txt]. All other files were used to test the code. +Files used in Ava's Quiz Show: [quiz_game.c], [questions.txt], and [answers.txt]. All other files in Final Code folder were used to test the code in the main file. I hope you enjoy Ava's Quiz Show! @@ -23,3 +24,7 @@ I hope you enjoy Ava's Quiz Show! compile statement: gcc quiz_game.c -o quiz_game ./quiz_game + + + + From e706d09c625352997eca3e59f1d83ea9ae089d20 Mon Sep 17 00:00:00 2001 From: AvaEN Date: Fri, 15 Jul 2016 15:45:41 -0400 Subject: [PATCH 6/7] Update extra.c --- FinalProject/extra.c | 395 ------------------------------------------- 1 file changed, 395 deletions(-) diff --git a/FinalProject/extra.c b/FinalProject/extra.c index 439f222..8b13789 100644 --- a/FinalProject/extra.c +++ b/FinalProject/extra.c @@ -1,396 +1 @@ -/* - switch(r1){ - case 1: - printf("\n\nWhich of the following is a Palindrome number?"); - printf("\n\nA.42042\t\tB.101010\n\nC.23232\t\tD.01234"); - - if (toupper(getchar())=='C'){ - printf("\n\nCorrect!!!");count++; - getchar(); - break; -} - else - { - printf("\n\nWrong!!! The correct answer is C.23232"); - getchar(); - break; - } - case 2: - printf("\n\n\nThe country with the highest environmental performance index is..."); - printf("\n\nA.France\t\tB.Denmark\n\nC.Switzerland\t\tD.Finland"); - if (toupper(getchar())=='C') - {printf("\n\nCorrect!!!");count++; - getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is C.Switzerland"); - getchar(); - break;} - - case 3: - printf("\n\n\nWhich animal laughs like human being?"); - printf("\n\nA.Polar Bear\t\tB.Hyena\n\nC.Donkey\t\tD.Chimpanzee"); - if (toupper(getchar())=='B') - {printf("\n\nCorrect!!!");count++; - getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is B.Hyena"); - getchar(); - break;} - - case 4: - printf("\n\n\nWho was awarded the youngest player award in Fifa World Cup 2006?"); - printf("\n\nA.Wayne Rooney\t\tB.Lucas Podolski\n\nC.Lionel Messi\t\tD.Christiano Ronaldo"); - if (toupper(getchar())=='B') - {printf("\n\nCorrect!!!");count++; - getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is B.Lucas Podolski"); - getchar(); - break;} - - case 5: - printf("\n\n\nWhich is the third highest mountain in the world?"); - printf("\n\nA.Mt. K2\t\tB.Mt. Kanchanjungha\n\nC.Mt. Makalu\t\tD.Mt. Kilimanjaro"); - if (toupper(getchar())=='B') - {printf("\n\nCorrect!!!");count++; - getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is B.Mt. Kanchanjungha"); - getchar(); - break;} - - case 6: - printf("\n\n\nWhat is the group of frogs known as?"); - printf("\n\nA.A traffic\t\tB.A toddler\n\nC.A police\t\tD.An Army"); - if (toupper(getchar())=='D' ) - {printf("\n\nCorrect!!!");count++; - getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is D.An Army"); - getchar(); - break;}} - } - - if(count>=2) - {goto test;} - else - { - system("clear"); - printf("\n\nSORRY YOU ARE NOT ELIGIBLE TO PLAY THIS GAME, BETTER LUCK NEXT TIME"); - getchar(); - goto mainhome; - } - test: - system("clear"); - printf("\n\n\t*** CONGRATULATION %s you are eligible to play the Game ***",playername); - printf("\n\n\n\n\t!Press any key to Start the Game!"); - if(toupper(getchar())=='p') - {goto game;} -game: - countr=0; - for(i=1;i<=10;i++) - {system("clear"); - r=i; - - switch(r) - { - case 1: - printf("\n\nWhat is the National Game of England?"); - printf("\n\nA.Football\t\tB.Basketball\n\nC.Cricket\t\tD.Baseball"); - if (toupper(getchar())=='C') - {printf("\n\nCorrect!!!");countr++;getchar(); - break;getchar();} - else - {printf("\n\nWrong!!! The correct answer is C.Cricket");getchar(); - goto score; - break;} - - case 2: - printf("\n\n\nStudy of Earthquake is called............,"); - printf("\n\nA.Seismology\t\tB.Cosmology\n\nC.Orology\t\tD.Etimology"); - if (toupper(getchar())=='A') - {printf("\n\nCorrect!!!");countr++;getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is A.Seismology");getchar(); - goto score; - break; - } - - case 3: - printf("\n\n\nAmong the top 10 highest peaks in the world, how many lie in Nepal? "); - printf("\n\nA.6\t\tB.7\n\nC.8\t\tD.9"); - if (toupper(getchar())=='C') - {printf("\n\nCorrect!!!");countr++;getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is C.8");getchar(); - goto score; - break;} - - case 4: - printf("\n\n\nThe Laws of Electromagnetic Induction were given by?"); - printf("\n\nA.Faraday\t\tB.Tesla\n\nC.Maxwell\t\tD.Coulomb"); - if (toupper(getchar())=='A') - {printf("\n\nCorrect!!!");countr++;getchar(); - break;} - else - { - printf("\n\nWrong!!! The correct answer is A.Faraday");getchar(); - goto score; - break; - } - - case 5: - printf("\n\n\nIn what unit is electric power measured?"); - printf("\n\nA.Coulomb\t\tB.Watt\n\nC.Power\t\tD.Units"); - if (toupper(getchar())=='B') - {printf("\n\nCorrect!!!");countr++;getchar(); break;} - else - { - printf("\n\nWrong!!! The correct answer is B.Power"); - getchar(); - goto score; - break; - } - - case 6: - printf("\n\n\nWhich element is found in Vitamin B12?"); - printf("\n\nA.Zinc\t\tB.Cobalt\n\nC.Calcium\t\tD.Iron"); - if (toupper(getchar())=='B' ) - {printf("\n\nCorrect!!!");countr++;getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is B.Cobalt");goto score; - getchar(); - break;} - - case 7: - printf("\n\n\nWhat is the National Name of Japan?"); - printf("\n\nA.Polska\t\tB.Hellas\n\nC.Drukyul\t\tD.Nippon"); - if (toupper(getchar())=='D') - {printf("\n\nCorrect!!!");countr++;getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is D.Nippon");getchar(); - goto score; - break;} - - case 8: - printf("\n\n\nHow many times a piece of paper can be folded at the most?"); - printf("\n\nA.6\t\tB.7\n\nC.8\t\tD.Depends on the size of paper"); - if (toupper(getchar())=='B') - {printf("\n\nCorrect!!!");countr++;getchar(); break;} - else - {printf("\n\nWrong!!! The correct answer is B.7");getchar(); - goto score; - break;} - - case 9: - printf("\n\n\nWhat is the capital of Denmark?"); - printf("\n\nA.Copenhagen\t\tB.Helsinki\n\nC.Ajax\t\tD.Galatasaray"); - if (toupper(getchar())=='A') - {printf("\n\nCorrect!!!");countr++; getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is A.Copenhagen");getchar(); - goto score; - break;} - - case 10: - printf("\n\n\nWhich is the longest River in the world?"); - printf("\n\nA.Nile\t\tB.Koshi\n\nC.Ganga\t\tD.Amazon"); - if (toupper(getchar())=='A') - {printf("\n\nCorrect!!!");countr++;getchar(); break;} - else - {printf("\n\nWrong!!! The correct answer is A.Nile");getchar();break;goto score;} - - case 11: - printf("\n\n\nWhat is the color of the Black Box in aeroplanes?"); - printf("\n\nA.White\t\tB.Black\n\nC.Orange\t\tD.Red"); - if (toupper(getchar())=='C') - {printf("\n\nCorrect!!!");countr++;getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is C.Orange");getchar(); - break;goto score;} - - case 12: - printf("\n\n\nWhich city is known at 'The City of Seven Hills'?"); - printf("\n\nA.Rome\t\tB.Vactican City\n\nC.Madrid\t\tD.Berlin"); - if (toupper(getchar())=='A') - {printf("\n\nCorrect!!!");countr++;getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is A.Rome");getchar(); - break;goto score;} - - case 13: - printf("\n\n\nName the country where there no mosquitoes are found?"); - printf("\n\nA.Japan\t\tB.Italy\n\nC.Argentina\t\tD.France"); - if (toupper(getchar())=='D'){ - printf("\n\nCorrect!!!");countr++;getchar(); - break; - } - else{ - printf("\n\nWrong!!! The correct answer is D.France");getchar(); - break; - goto score; - } - - case 14: - printf("\n\n\nWho is the author of 'Pulpasa Cafe'?"); - printf("\n\nA.Narayan Wagle\t\tB.Lal Gopal Subedi\n\nC.B.P. Koirala\t\tD.Khagendra Sangraula"); - if (toupper(getchar())=='A'){ - printf("\n\nCorrect!!!"); - countr++; - getchar(); - break; - } - else{ - printf("\n\nWrong!!! The correct answer is A.Narayan Wagle"); - getchar(); - break; - goto score;} - - case 15: - printf("\n\n\nWhich Blood Group is known as the Universal Recipient?"); - printf("\n\nA.A\t\tB.AB\n\nC.B\t\tD.O"); - if (toupper(getchar())=='B'){ - printf("\n\nCorrect!!!"); - countr++; - getchar(); - break; - } - else{ - printf("\n\nWrong!!! The correct answer is B.AB"); - getchar(); - goto score; - break; - } - case 16: - printf("\n\n\nWhat is the unit of measurement of distance between Stars?"); - printf("\n\nA.Light Year\t\tB.Coulomb\n\nC.Nautical Mile\t\tD.Kilometer"); - if (toupper(getchar())=='A'){ - printf("\n\nCorrect!!!"); - countr++; - getchar(); - break; - } - else{ - printf("\n\nWrong!!! The correct answer is A.Light Year");getchar(); - goto score; - break; - } - - case 17: - printf("\n\n\nThe country famous for Samba Dance is........"); - printf("\n\nA.Brazil\t\tB.Venezuela\n\nC.Nigeria\t\tD.Bolivia"); - if (toupper(getchar())=='A'){ - printf("\n\nCorrect!!!"); - countr++; - getchar(); - break; - } - else{ - printf("\n\nWrong!!! The correct answer is A.Brazil");getchar();goto score; - break; - } - - case 18: - printf("\n\n\nWind speed is measure by__________?"); - printf("\n\nA.Lysimeter\t\tB.Air vane\n\nC.Hydrometer\t\tD.Anemometer\n\n"); - if (toupper(getchar())=='D'){ - printf("\n\nCorrect!!!"); - countr++; - getchar(); - break; - } - else{ - printf("\n\nWrong!!! The correct answer is D.Anemometer"); - getchar(); - goto score; - break; - } - - case 19: - printf("\n\n\nWhich city in the world is popularly known as The City of Temple?"); - printf("\n\nA.Delhi\tB.Bhaktapur\n\nC.Kathmandu\tD.Agra\n\n"); - if (toupper(getchar())=='C'){ - printf("\n\nCorrect!!!"); - countr++; - getchar(); - break; - } - else{ - printf("\n\nWrong!!! The correct answer is C.Kathmandu"); - getchar(); - goto score; - break; - } - - case 20: - printf("\n\n\nWhich hardware was used in the First Generation Computer?"); - printf("\n\nA.Transistor\t\tB.Valves\n\nC.I.C\t\tD.S.S.I"); - if (toupper(getchar())=='B'){ - printf("\n\nCorrect!!!"); - countr++; - getchar(); - break; - } - else{ - printf("\n\nWrong!!! The correct answer is B.Valves"); - getchar(); - goto score; - break; - } - - case 21: - printf("\n\n\nOzone plate is being destroyed regularly because of____ ?"); - printf("\n\nA.L.P.G\t\tB.Nitrogen\n\nC.Methane\t\tD. C.F.C"); - if (toupper(getchar())=='D') - {printf("\n\nCorrect!!!");countr++; getchar(); - break;} - else - {printf("\n\nWrong!!! The correct answer is D. C.F.C");getchar();goto score; - break;} - - case 22: - printf("\n\n\nWho won the Women's Australian Open Tennis in 2007?"); - printf("\n\nA.Martina Hingis\t\tB.Maria Sarapova\n\nC.Kim Clijster\t\tD.Serena Williams"); - if (toupper(getchar())=='D'){ - printf("\n\nCorrect!!!"); - countr++; - getchar(); - break; - } - - else{ - printf("\n\nWrong!!! The correct answer is D.Serena Williams"); - getchar(); - goto score; - break; - } - - case 23: - printf("\n\n\nWhich film was awarded the Best Motion Picture at Oscar in 2010?"); - printf("\n\nA.The Secret in their Eyes\t\tB.Shutter Island\n\nC.The King's Speech\t\tD.The Reader"); - if (toupper(getchar())=='C'){ - printf("\n\nCorrect!!!");countr++; getchar(); - break; - } - else{ - printf("\n\nWrong!!! The correct answer is C.The King's Speech"); - getchar(); - goto score; - break; - } - } -} -*/ From 6b7adbbb78d18451f55615c14dea080fac87f712 Mon Sep 17 00:00:00 2001 From: AvaEN Date: Sun, 17 Jul 2016 01:43:18 -0400 Subject: [PATCH 7/7] Update readme.txt --- FinalProject/readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FinalProject/readme.txt b/FinalProject/readme.txt index 0fe102f..3dc2c55 100644 --- a/FinalProject/readme.txt +++ b/FinalProject/readme.txt @@ -7,7 +7,7 @@ This is a quiz show game programmed in C during Columbia HSP. My project takes q In my proposal, I mentioned including a timer; however, I decided in the end not to add one. I also stated in my introduction that I would have different slots for different categories with different point systems. I later decided that I would not have different categories but a list of questions that players of 'Ava's Quiz Game' would need to answer. Although I did not have time to include graphics, I created a fun looking 'main menu'! -All of the answers to the questions, if you want to beat the game, is in answer.txt . If you want to view the question and the answer at the same time, go to line -- and uncomment it. (but I recommend playing without looking at the answers first!) +All of the answers to the questions, if you want to beat the game, are in answer.txt . I got my idea of how to set up Ava's Quiz Show here: http://www.codewithc.com/quiz-game-mini-project-in-c/