Guest User

Untitled

a guest
Sep 23rd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 17.04 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. const int MAXLENGTH=100;
  5.  
  6. clrscr(){
  7.  
  8. int clear;
  9. clear=0;
  10.  
  11.     while(clear!=25){
  12.         printf("\n");
  13.         clear++;
  14.     }
  15.  
  16. }
  17.  
  18. cont(){
  19.  
  20. int choice;
  21.  
  22. printf("1 - Yes\n"
  23.        "2 - No\n"
  24.        "Do you want to play again?\n");
  25. scanf("%d", &choice);
  26.  
  27.     while(choice!=1 && choice!=2){
  28.         printf("Play Again?\n");
  29.         scanf("%d", &choice);
  30.     }
  31.  
  32.     if(choice==1){
  33.         clrscr();
  34.         main();
  35.     }
  36.     else if(choice==2){
  37.         clrscr();
  38.         return 0;
  39.     }
  40.  
  41. }
  42.  
  43. cont_cntry(){
  44.  
  45. clrscr();
  46.  
  47. int c_choice;
  48.  
  49. printf("***************************** - Name the Country - *****************************\n");
  50.  
  51. printf(" 1 - Asia\n"
  52.        " 2 - North America\n"
  53.        " 3 - Africa\n"
  54.        " 4 - South America\n"
  55.        " 5 - Australia\n"
  56.        " 6 - Europe\n"
  57.        " 7 - Quit\n");
  58.  
  59. printf("\nChoose Continent: ");
  60. scanf("%d", &c_choice);
  61.  
  62.     if(c_choice==1){
  63.         asia_cntry();
  64.     }
  65.     else if(c_choice==7){
  66.         return 0;
  67.     }
  68. }
  69.  
  70. asia_cntry(){
  71.  
  72. clrscr();
  73.  
  74. printf("************************** - Name the Country: Asia - **************************");
  75. printf("Directions: Give the answer of the following questions. Use and underscore '_'  instead of a space to separate two or more words answers.");
  76. printf("\n********************************************************************************\n");
  77.  
  78. char *cptl[]={"Kuala lumpur",
  79.             "Singapore",
  80.             "Manila",
  81.             "Bangkok",
  82.             "Yangon",
  83.             "Hanoi",
  84.             "Beijing",
  85.             "Pyongyang",
  86.             "Taipei",
  87.             "Tokyo",
  88.             "Baghdad",
  89.             "Abu Dhabi",
  90.             "New Delhi",
  91.             "Jakarta",
  92.             "Male",
  93.             "Riyadh",
  94.             "Kuwait City",
  95.             "Seoul",
  96.             "Jerusalem",
  97.             "Dili",
  98.             "Sanaa",
  99.             "Damascus",
  100.             "Nicosia",
  101.             "Beirut",
  102.             "Victoria",
  103.             "Doha",
  104.             "Colombo",
  105.             "Astana",
  106.             "Ashgabat",
  107.             "Tashkent",
  108.             "Amman",
  109.             "Ankara",
  110.             "Manama",
  111.             "Dhaka",
  112.             "Dushnabe",
  113.             "Baku",
  114.             "Kathmandu",
  115.             "Muscat",
  116.             "Islamabad",
  117.             "Ulan_Bator",
  118.             "Tehran",
  119.             "Bishkek",
  120.             "Vientiane",
  121.             "Yerevan",
  122.             "Tbilisi",
  123.             "Thimphu",
  124.             "Kabul",
  125.             "Phnom Penh",
  126.             "Bandar Seri Begawan",
  127.             };
  128.  
  129. char *cntry[]={"Malaysia",
  130.                 "Singapore",
  131.                 "Philippines",
  132.                 "Thailand",
  133.                 "Myanmar",
  134.                 "Vietnam",
  135.                 "China",
  136.                 "North_Korea",
  137.                 "Taiwan",
  138.                 "Japan",
  139.                 "Iraq",
  140.                 "United_Arab_Emirates",
  141.                 "India",
  142.                 "Indonesia",
  143.                 "Maldives",
  144.                 "Saudi_Arabia",
  145.                 "Kuwait",
  146.                 "South_Korea",
  147.                 "Israel",
  148.                 "East_Timor",
  149.                 "Yemen",
  150.                 "Syria",
  151.                 "Cyprus",
  152.                 "Lebanon",
  153.                 "Hong_Kong",
  154.                 "Qatar",
  155.                 "Sri_Lanka",
  156.                 "Kazakhstan",
  157.                 "Turkmenistan",
  158.                 "Uzbekistan",
  159.                 "Jordan",
  160.                 "Turkey",
  161.                 "Bahrain",
  162.                 "Bangladesh",
  163.                 "Tajikistan",
  164.                 "Azerbaijan",
  165.                 "Nepal",
  166.                 "Oman",
  167.                 "Pakistan",
  168.                 "Mongolia",
  169.                 "Iran",
  170.                 "Kyrgyzstan",
  171.                 "Laos",
  172.                 "Armenia",
  173.                 "Georgia",
  174.                 "Bhutan",
  175.                 "Afghanistan",
  176.                 "Cambodia",
  177.                 "Brunei_Darussalam"
  178.                 };
  179.  
  180. char *clue_1[]={"M*******",
  181.                 "S********",
  182.                 "P**********",
  183.                 "T*******",
  184.                 "M******",
  185.                 "V******",
  186.                 "C****",
  187.                 "N****_K****",
  188.                 "T*****",
  189.                 "J****",
  190.                 "I***",
  191.                 "U*****_A***_E*******",
  192.                 "I*****",
  193.                 "I********",
  194.                 "M*******",
  195.                 "S****_A*****",
  196.                 "K*****",
  197.                 "S****_K****",
  198.                 "I*****",
  199.                 "E***_T*****",
  200.                 "Y****",
  201.                 "S****",
  202.                 "C*****",
  203.                 "L******",
  204.                 "H***_K***",
  205.                 "Q****",
  206.                 "S**_L****",
  207.                 "K*********",
  208.                 "T***********",
  209.                 "U*********",
  210.                 "J*****",
  211.                 "T*****",
  212.                 "B******",
  213.                 "B*********",
  214.                 "T*********",
  215.                 "A*********",
  216.                 "N****",
  217.                 "O***",
  218.                 "P*******",
  219.                 "M*******",
  220.                 "I***",
  221.                 "K*********",
  222.                 "L***",
  223.                 "A******",
  224.                 "G******",
  225.                 "B*****",
  226.                 "A**********",
  227.                 "C*******",
  228.                 "B*****_D*********"
  229.                 };
  230.  
  231. char *clue_2[]={"M******a",
  232.                 "S*******e",
  233.                 "P*********s",
  234.                 "T******d",
  235.                 "M*****r",
  236.                 "V*****m",
  237.                 "C***a",
  238.                 "N***h_K***a",
  239.                 "T****n",
  240.                 "J***n",
  241.                 "I**q",
  242.                 "U****d_A**b_E******s",
  243.                 "I***a",
  244.                 "I*******a",
  245.                 "M******s",
  246.                 "S***i_A****a",
  247.                 "K****t",
  248.                 "S***h_K***a",
  249.                 "I****l",
  250.                 "E**t_T***r",
  251.                 "Y***n",
  252.                 "S***a",
  253.                 "C****s",
  254.                 "L*****n",
  255.                 "H**g_K**g",
  256.                 "Q***r",
  257.                 "S*i_L***a",
  258.                 "K********n",
  259.                 "T**********n",
  260.                 "U********n",
  261.                 "J****n",
  262.                 "T****y",
  263.                 "B*****n",
  264.                 "B********h",
  265.                 "T********n",
  266.                 "A********n",
  267.                 "N***l",
  268.                 "O**n",
  269.                 "P******n",
  270.                 "M******a",
  271.                 "I**n",
  272.                 "K********n",
  273.                 "L**s",
  274.                 "A*****a",
  275.                 "G*****a",
  276.                 "B****n",
  277.                 "A*********n",
  278.                 "C******a",
  279.                 "B****i_D********m"
  280.                 };
  281.  
  282. char guess[MAXLENGTH];
  283.  
  284. int ac;
  285. int bc;
  286. int compare;
  287.  
  288.     for(ac=0; ac<49; ac++){
  289.         printf("\n\nWhat country has the capital of ");
  290.         printf("%s?\n\n", cptl[ac]);
  291.         scanf("%s", guess);
  292.  
  293.         for(bc=0; bc<3; bc++){
  294.                 compare=stricmp(guess, cntry[ac]);
  295.                     if(bc==0 && compare==0){
  296.                         printf("\nCorrect Answer!\n");
  297.                         break;
  298.                     }
  299.                     else if(bc==0 && compare!=0){
  300.                         printf("\nTry Again!\n");
  301.                         printf("\nClue: %s\n", clue_1[ac]);
  302.                         printf("Your Answer: ");
  303.                         scanf("%s", guess);
  304.                     }
  305.                     if(bc==1 && compare==0){
  306.                         printf("\nCorrect Answer!\n");
  307.                         break;
  308.                     }
  309.                     else if(bc==1 && compare!=0){
  310.                         printf("\nLast Try!\n");
  311.                         printf("\nClue: %s\n", clue_2[ac]);
  312.                         printf("Your Answer: ");
  313.                         scanf("%s", guess);
  314.                     }
  315.                     if(bc==2 && compare==0){
  316.                         printf("\nCorrect Answer!\n");
  317.                     }
  318.                     else if(bc==2 && compare!=0){
  319.                         printf("The correct answer is: %s\n", cntry[ac]);
  320.                         break;
  321.                     }
  322.         }
  323.  
  324.         if(compare!=0){
  325.             clrscr();
  326.             cont();
  327.         }
  328.         else if(ac==49 && compare==0){
  329.             break;
  330.         }
  331.  
  332.     }
  333.  
  334. clrscr();
  335. printf("\n********************************************************************************\n");
  336. printf("Congratulations! You have completed 'Name the Country: Asia Category'!\n\n\n\n\n\n\n\n");
  337. printf("\n********************************************************************************\n\n\n\n\n\n\n\n\n");
  338. cont();
  339.  
  340. }
  341.  
  342. cont_cptl(){
  343.  
  344. printf("***************************** - Name the Capital - *****************************\n");
  345.  
  346. int c_choice;
  347.  
  348. printf(" 1 - Asia\n"
  349.        " 2 - North America\n"
  350.        " 3 - Africa\n"
  351.        " 4 - South America\n"
  352.        " 5 - Australia\n"
  353.        " 6 - Europe\n"
  354.        " 7 - Quit\n");
  355.  
  356. printf("\nChoose Continent: ");
  357. scanf("%d", &c_choice);
  358.  
  359.     if(c_choice==1){
  360.         asia_cptl();
  361.     }
  362.     else if(c_choice==7){
  363.         return 0;
  364.     }
  365. }
  366.  
  367. asia_cptl(){
  368.  
  369. clrscr();
  370.  
  371. printf("\n************************** - Name the Capital: Asia - **************************\n");
  372. printf("Directions: Give the answer of the following questions. Use and underscore '_'  instead of a space to separate two or more words answers.\n");
  373. printf("\n********************************************************************************\n");
  374.  
  375. char *cntry[]={"Philippines",
  376.                 "Singapore",
  377.                 "Malaysia",
  378.                 "Thailand",
  379.                 "China",
  380.                 "Vietnam",
  381.                 "Myanmar",
  382.                 "North Korea",
  383.                 "Iraq",
  384.                 "Japan",
  385.                 "Taiwan",
  386.                 "United Arab Emirates",
  387.                 "Maldives",
  388.                 "Indonesia",
  389.                 "India",
  390.                 "Saudi Arabia",
  391.                 "Israel",
  392.                 "South Korea",
  393.                 "Kuwait",
  394.                 "East Timor",
  395.                 "Cyprus",
  396.                 "Syria",
  397.                 "Yemen",
  398.                 "Lebanon",
  399.                 "Sri Lanka",
  400.                 "Qatar",
  401.                 "Hong Kong",
  402.                 "Kazakhstan",
  403.                 "Jordan",
  404.                 "Uzbekistan",
  405.                 "Turkmenistan",
  406.                 "Turkey",
  407.                 "Tajikistan",
  408.                 "Bangladesh",
  409.                 "Bahrain",
  410.                 "Azerbaijan",
  411.                 "Pakistan",
  412.                 "Oman",
  413.                 "Nepal",
  414.                 "Mongolia",
  415.                 "Laos",
  416.                 "Kyrgyzstan",
  417.                 "Iran",
  418.                 "Armenia",
  419.                 "Afghanistan",
  420.                 "Bhutan",
  421.                 "Georgia",
  422.                 "Cambodia",
  423.                 "Brunei Darussalam"
  424.                 };
  425.  
  426. char *cptl[]={"Manila",
  427.             "Singapore",
  428.             "Kuala_Lumpur",
  429.             "Bangkok",
  430.             "Beijing",
  431.             "Hanoi",
  432.             "Yangon",
  433.             "Pyongyang",
  434.             "Baghdad",
  435.             "Tokyo",
  436.             "Taipei",
  437.             "Abu_Dhabi",
  438.             "Male",
  439.             "Jakarta",
  440.             "New_Delhi",
  441.             "Riyadh",
  442.             "Jerusalem",
  443.             "Seoul",
  444.             "Kuwait_City",
  445.             "Dili",
  446.             "Nicosia",
  447.             "Damascus",
  448.             "Sanaa",
  449.             "Beirut",
  450.             "Colombo",
  451.             "Doha",
  452.             "Victoria",
  453.             "Astana",
  454.             "Amman",
  455.             "Tashkent",
  456.             "Ashgabat",
  457.             "Ankara",
  458.             "Dushnabe",
  459.             "Dhaka",
  460.             "Manama",
  461.             "Baku",
  462.             "Islamabad",
  463.             "Muscat",
  464.             "Kathmandu",
  465.             "Ulan_Bator",
  466.             "Vientiane",
  467.             "Bishkek",
  468.             "Tehran",
  469.             "Yerevan",
  470.             "Kabul",
  471.             "Thimphu",
  472.             "Tbilisi",
  473.             "Phnom_Penh",
  474.             "Bandar_Seri_Begawan",
  475.             };
  476.  
  477. char *clue_1[]={"M*****",
  478.             "S********",
  479.             "K****_L*****",
  480.             "B******",
  481.             "B******",
  482.             "H****",
  483.             "Y*****",
  484.             "P********",
  485.             "B******",
  486.             "T****",
  487.             "T*****",
  488.             "A**_D****",
  489.             "M***",
  490.             "J******",
  491.             "N**_D****",
  492.             "R*****",
  493.             "J********",
  494.             "S****",
  495.             "K*****_C***",
  496.             "D***",
  497.             "N******",
  498.             "D*******",
  499.             "S****",
  500.             "B*****",
  501.             "C******",
  502.             "D***",
  503.             "V*******",
  504.             "A*****",
  505.             "A****",
  506.             "T*******",
  507.             "A*******",
  508.             "A*****",
  509.             "D*******",
  510.             "D****",
  511.             "M*****",
  512.             "B***",
  513.             "I********",
  514.             "M*****",
  515.             "K********",
  516.             "U***_Ba***",
  517.             "V********",
  518.             "B******",
  519.             "T*****",
  520.             "Y******",
  521.             "K****",
  522.             "T******",
  523.             "T******",
  524.             "P****_P***",
  525.             "B*****_S***_B******",
  526.             };
  527.  
  528. char *clue_2[]={"M****a",
  529.             "S*******e",
  530.             "K***a_L****r",
  531.             "B*****k",
  532.             "B*****g",
  533.             "H***i",
  534.             "Y****n",
  535.             "P*******g",
  536.             "B*****d",
  537.             "T***o",
  538.             "T****i",
  539.             "A*u_D***i",
  540.             "M**e",
  541.             "J*****a",
  542.             "N*w_D***i",
  543.             "R****h",
  544.             "J*******m",
  545.             "S***l",
  546.             "K****t_C**y",
  547.             "D**i",
  548.             "N*****a",
  549.             "D******s",
  550.             "S***a",
  551.             "B****t",
  552.             "C*****o",
  553.             "D**a",
  554.             "V******a",
  555.             "A****a",
  556.             "A***n",
  557.             "T******t",
  558.             "A******t",
  559.             "A****a",
  560.             "D******e",
  561.             "D***a",
  562.             "M****a",
  563.             "B**u",
  564.             "I*******d",
  565.             "M****t",
  566.             "K*******u",
  567.             "U**n_B***r",
  568.             "V*******e",
  569.             "B*****k",
  570.             "T****n",
  571.             "Y*****n",
  572.             "K***l",
  573.             "T*****u",
  574.             "T*****i",
  575.             "P***m_P**h",
  576.             "B****r_S**i_B*****n",
  577.             };
  578.  
  579. char guess[MAXLENGTH];
  580.  
  581. int ac;
  582. int bc;
  583. int compare;
  584.  
  585.     for(ac=0; ac<49; ac++){
  586.         printf("\n\nWhat is the captital of ");
  587.         printf("%s?\n\n", cntry[ac]);
  588.         scanf("%s", guess);
  589.  
  590.         for(bc=0; bc<3; bc++){
  591.                 compare=stricmp(guess, cptl[ac]);
  592.                     if(bc==0 && compare==0){
  593.                         printf("\nCorrect Answer!\n");
  594.                         break;
  595.                     }
  596.                     else if(bc==0 && compare!=0){
  597.                         printf("\nTry Again!\n");
  598.                         printf("\nClue: %s\n", clue_1[ac]);
  599.                         printf("Your Answer: ");
  600.                         scanf("%s", guess);
  601.                     }
  602.                     if(bc==1 && compare==0){
  603.                         printf("\nCorrect Answer!\n");
  604.                         break;
  605.                     }
  606.                     else if(bc==1 && compare!=0){
  607.                         printf("\nLast Try!\n");
  608.                         printf("\nClue: %s\n", clue_2[ac]);
  609.                         printf("Your Answer: ");
  610.                         scanf("%s", guess);
  611.                     }
  612.                     if(bc==2 && compare==0){
  613.                         printf("\nCorrect Answer!\n");
  614.                     }
  615.                     else if(bc==2 && compare!=0){
  616.                         printf("The correct answer is: %s\n", cptl[ac]);
  617.                         break;
  618.                     }
  619.         }
  620.  
  621.         if(compare!=0){
  622.             clrscr();
  623.             cont();
  624.         }
  625.         else if(ac==49 && compare==0){
  626.             break;
  627.         }
  628.     }
  629.  
  630. clrscr();
  631. printf("\n********************************************************************************\n");
  632. printf("\t\tCongratulations! You have completed 'Name the Capital: Asia Category'!");
  633. printf("\n********************************************************************************\n\n\n\n\n\n\n\n\n");
  634. cont();
  635. }
  636.  
  637. int main(){
  638.  
  639. printf("********************** - Name The Country/Capital Game - ***********************\n");
  640.  
  641. int g_choice;
  642.  
  643. printf(" 1 - Name the Country\n"
  644.        " 2 - Name the Capital\n"
  645.        " 3 - Quit\n");
  646. printf("\nChoose Category: ");
  647. scanf("%d", &g_choice);
  648.  
  649.     while(g_choice!=1 && g_choice!=2 && g_choice!=3){
  650.         printf("\nChoose Category: ");
  651.         scanf("%d", &g_choice);
  652.     }
  653.  
  654.     if(g_choice==1){
  655.         cont_cntry();
  656.     }
  657.     else if(g_choice==2){
  658.         cont_cptl();
  659.     }
  660.     else if(g_choice==3){
  661.         return 0;
  662.     }
  663. }
Add Comment
Please, Sign In to add comment