You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.2 KiB

11 months ago
  1. #include <time.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include "wwm.h"
  5. int runde = 0;
  6. int geld = 0;
  7. int frage = 0;
  8. int useranswer;
  9. int test;
  10. int setGeld(int runde){
  11. int Geldstufen[] = {0, 100, 200, 300, 500, 1000, 2000, 4000, 8000, 16000, 32000, 64000, 125000, 250000, 500000, 1000000};
  12. geld = Geldstufen[runde];
  13. return geld;
  14. }
  15. int crandomNumber() {
  16. srand(time(NULL));
  17. frage = rand() % 10;
  18. return frage;
  19. }
  20. void wwm(){
  21. printf("Welcome to ´Who wants to be a millionaire?´ \n");
  22. const char* question[] = {
  23. "Which planet is known as the `blue planet`?",
  24. "What is the capital of Germany?",
  25. "What is the largest desert in the world?",
  26. "In which country would you find the Great Wall?",
  27. "How many meters are in a kilometer?",
  28. "How many colors are there in a rainbow?",
  29. "What is the square root of 25?",
  30. "Who painted the Mona Lisa?",
  31. "What is the largest ocean on earth?",
  32. "What is the largest planet in our solar system?"
  33. };
  34. const char* answers[][4] = {
  35. {"Mars", "Venus", "Earth", "Jupiter"},
  36. {"Munich", "Berlin", "Cologne", "Frankfurt am Main"},
  37. {"Antarctica", "Sahara", "Gobi", "Arctica" },
  38. {"USA", "China", "Russia", "Japan"},
  39. {"100", "10", "1", "1000"},
  40. {"6", "7", "8", "9"},
  41. {"5", "25", "20", "10"},
  42. {"Vincent van Gogh", "Pablo Picasso", "Leonardo da Vinci", "Michelangelo"},
  43. {"Pacific Ocean", "Atlantic Ocean", "Arctic Ocean", "Indian Ocean"},
  44. {"Merkur", "Jupiter", "Neptun", "Pluto"}
  45. };
  46. int correctAnswer[] = {
  47. 3, 2, 1, 2, 4
  48. };
  49. for (int r = 1; r <= 16; r++){
  50. if (r == 16) {
  51. printf("Congratulations ! You have won 1.000.000 $");
  52. return;
  53. }
  54. printf("__________________________________________________ \n\n");
  55. printf("You are at stage %d and have %d $\n", runde, geld);
  56. srand(time(0));
  57. crandomNumber();
  58. printf("Question %d: %s\n", runde + 1, question[frage]);
  59. for (int i = 0; i < 4; i++) {
  60. printf("%d. %s \n", i + 1, answers[frage][i]);
  61. int useranswer;
  62. printf("Your answer (1-4):");
  63. scanf("%d", &useranswer);
  64. if (useranswer == correctAnswer[frage]) {
  65. printf("That is correct!\n");
  66. runde++;
  67. setGeld(runde);
  68. }
  69. else {
  70. printf("What a shame! That is wrong!\n You lost %d $", geld);
  71. }
  72. }
  73. return;
  74. }
  75. }