97 lines
2.2 KiB
97 lines
2.2 KiB
#include <time.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "wwm.h"
|
|
|
|
int runde = 0;
|
|
int geld = 0;
|
|
int frage = 0;
|
|
int useranswer;
|
|
int test;
|
|
|
|
int setGeld(int runde){
|
|
int Geldstufen[] = {0, 100, 200, 300, 500, 1000, 2000, 4000, 8000, 16000, 32000, 64000, 125000, 250000, 500000, 1000000};
|
|
geld = Geldstufen[runde];
|
|
return geld;
|
|
}
|
|
|
|
|
|
int crandomNumber() {
|
|
srand(time(NULL));
|
|
frage = rand() % 10;
|
|
return frage;
|
|
|
|
}
|
|
|
|
|
|
|
|
void wwm(){
|
|
|
|
printf("Welcome to ´Who wants to be a millionaire?´ \n");
|
|
|
|
const char* question[] = {
|
|
"Which planet is known as the `blue planet`?",
|
|
"What is the capital of Germany?",
|
|
"What is the largest desert in the world?",
|
|
"In which country would you find the Great Wall?",
|
|
"How many meters are in a kilometer?",
|
|
"How many colors are there in a rainbow?",
|
|
"What is the square root of 25?",
|
|
"Who painted the Mona Lisa?",
|
|
"What is the largest ocean on earth?",
|
|
"What is the largest planet in our solar system?"
|
|
};
|
|
|
|
const char* answers[][4] = {
|
|
{"Mars", "Venus", "Earth", "Jupiter"},
|
|
{"Munich", "Berlin", "Cologne", "Frankfurt am Main"},
|
|
{"Antarctica", "Sahara", "Gobi", "Arctica" },
|
|
{"USA", "China", "Russia", "Japan"},
|
|
{"100", "10", "1", "1000"},
|
|
{"6", "7", "8", "9"},
|
|
{"5", "25", "20", "10"},
|
|
{"Vincent van Gogh", "Pablo Picasso", "Leonardo da Vinci", "Michelangelo"},
|
|
{"Pacific Ocean", "Atlantic Ocean", "Arctic Ocean", "Indian Ocean"},
|
|
{"Merkur", "Jupiter", "Neptun", "Pluto"}
|
|
};
|
|
|
|
int correctAnswer[] = {
|
|
3, 2, 1, 2, 4
|
|
};
|
|
|
|
|
|
for (int r = 1; r <= 16; r++){
|
|
if (r == 16) {
|
|
printf("Congratulations ! You have won 1.000.000 $");
|
|
return;
|
|
}
|
|
|
|
|
|
printf("__________________________________________________ \n\n");
|
|
printf("You are at stage %d and have %d $\n", runde, geld);
|
|
srand(time(0));
|
|
crandomNumber();
|
|
printf("Question %d: %s\n", runde + 1, question[frage]);
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
printf("%d. %s \n", i + 1, answers[frage][i]);
|
|
|
|
int useranswer;
|
|
printf("Your answer (1-4):");
|
|
scanf("%d", &useranswer);
|
|
|
|
|
|
if (useranswer == correctAnswer[frage]) {
|
|
printf("That is correct!\n");
|
|
runde++;
|
|
setGeld(runde);
|
|
}
|
|
else {
|
|
printf("What a shame! That is wrong!\n You lost %d $", geld);
|
|
}
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
}
|