Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

using System;

namespace QuizBot
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Welcome to my quiz bot!");
Console.WriteLine("Select topic:");
Console.WriteLine("1. Sports");
Console.WriteLine("2. Art");
Console.WriteLine("3. Music");
Console.WriteLine("4. History");
Console.WriteLine("5. Movie");

int selectedTopic;
do
{
Console.Write("Select the number of topic: ");
} while (!int.TryParse(Console.ReadLine(), out selectedTopic) ||
selectedTopic < 1 || selectedTopic > 5);

int score = 0;

switch (selectedTopic)
{
case 1:
score = RunSportsQuiz();
break;
case 2:
score = RunArtQuiz();
break;
case 3:
score = RunMusicQuiz();
break;
case 4:
score = RunHistoryQuiz();
break;
case 5:
score = RunMoviesQuiz();
break;
}

Console.WriteLine($"Your quiz score: {score}/5");

if (score == 5)
{
Console.WriteLine("Congrats! You can get full score from
project!");
}
else
{
Console.WriteLine("Sorry, you failed, please try again!");
}
}

static int RunSportsQuiz()


{
Console.WriteLine("Sport Quiz");
int score = 0;

string[] sportsQuestions = {
"Which country won the 2022 FIFA World Cup?\nA) France\nB)
Argentina\nC) Brazilia\nD) Germany",
"Who is considered the greatest basketball player of all
time?\nA) Michael Jordan\nB) LeBron James\nC) Kobe Bryant\nD) Shaquille O'Neal",
"Which club is the biggest club of Turkey?\nA) Fenerbahce\
nB) Galatasaray\nC) Besiktas\nD) Trabzonspor",
"Which country won the FIFA World Cup in 2018?\nA) Brazil\
nB) Germany\nC) France\nD) Spain",
"Who has won Formula 1 the most? ?\nA) Sebastian Vettel\nB)
Lewis Hamilton\nC) Fernando Alonso\nD) Verstappen"
};

string[] sportsAnswers = { "B", "A", "C", "C", "B" };

for (int i = 0; i < sportsQuestions.Length; i++)


{
Console.WriteLine($"Question {i + 1}:
{sportsQuestions[i]}");
Console.Write("Your answer: ");
string userAnswer = Console.ReadLine().ToUpper();

if (userAnswer == sportsAnswers[i])
{
Console.WriteLine("Correct!");
score++;
}
else
{
Console.WriteLine($"Incorrect. The correct answer is
{sportsAnswers[i]}");
}
}

DisplayResult(score);
return score;
}

static int RunArtQuiz()


{
Console.WriteLine("Art Quiz");
int score = 0;

string[] artQuestions = {
"Who painted the Starry Night?\nA) Leonardo da Vinci\nB)
Vincent van Gogh\nC) Pablo Picasso\nD) Claude Monet",
"What is the name of Leonardo da Vinci's famous mural in
Milan?\nA) The Last Supper\nB) The Sistine Chapel\nC) The Birth of Venus\nD) The
Persistence of Memory",
"Which art movement is known for its use of geometric
shapes and primary colors?\nA) Impressionism\nB) Cubism\nC) Surrealism\nD)
Baroque",
"Who is famous for creating sculptures like 'The Thinker'
and 'The Kiss'?\nA) Michelangelo\nB) Auguste Rodin\nC) Salvador Dali\nD) Frida
Kahlo",
"What art style is characterized by exaggerated
perspectives and distorted forms?\nA) Realism\nB) Romanticism\nC) Expressionism\nD)
Cubism"
};

string[] artAnswers = { "B", "A", "B", "B", "D" };

for (int i = 0; i < artQuestions.Length; i++)


{
Console.WriteLine($"Question {i + 1}: {artQuestions[i]}");
Console.Write("Your answer: ");
string userAnswer = Console.ReadLine().ToUpper();

if (userAnswer == artAnswers[i])
{
Console.WriteLine("Correct!");
score++;
}
else
{
Console.WriteLine($"Incorrect. The correct answer is
{artAnswers[i]}");
}
}

DisplayResult(score);
return score;
}

static int RunMusicQuiz()


{
Console.WriteLine("Music Quiz");
int score = 0;

string[] musicQuestions = {
"Who is known as the 'King of Pop'?\nA) Michael Jackson\nB)
Elvis Presley\nC) Prince\nD) Madonna",
"What musical instrument does Yo-Yo Ma play?\nA) Violin\nB)
Piano\nC) Cello\nD) Trumpet",
"Which band released the album 'The Dark Side of the
Moon'?\nA) The Rolling Stones\nB) Pink Floyd\nC) Led Zeppelin\nD) The Beatles",
"Who composed the 'Symphony No. 9'?\nA) Ludwig van
Beethoven\nB) Wolfgang Amadeus Mozart\nC) Johann Sebastian Bach\nD) Antonio
Vivaldi",
"Which famous composer went deaf later in life?\nA) Johann
Sebastian Bach\nB) Wolfgang Amadeus Mozart\nC) Ludwig van Beethoven\nD) Pyotr
Ilyich Tchaikovsky"
};

string[] musicAnswers = { "A", "C", "B", "A", "C" };

for (int i = 0; i < musicQuestions.Length; i++)


{
Console.WriteLine($"Question {i + 1}:
{musicQuestions[i]}");
Console.Write("Your answer: ");
string userAnswer = Console.ReadLine().ToUpper();

if (userAnswer == musicAnswers[i])
{
Console.WriteLine("Correct!");
score++;
}
else
{
Console.WriteLine($"Incorrect. The correct answer is
{musicAnswers[i]}");
}
}

DisplayResult(score);
return score;
}

static int RunHistoryQuiz()


{
Console.WriteLine("History Quiz");
int score = 0;

string[] historyQuestions = {
"Who was the first President of the United States?\nA)
George Washington\nB) Thomas Jefferson\nC) Benjamin Franklin\nD) John Adams",
"What year did World War II end?\nA) 1943\nB) 1944\nC)
1945\nD) 1946",
"Which ancient civilization built the Great Wall of China?\
nA) Greek\nB) Roman\nC) Chinese\nD) Egyptian",
"Who wrote 'The Communist Manifesto'?\nA) Karl Marx\nB)
Friedrich Engels\nC) Vladimir Lenin\nD) Leon Trotsky",
"What was the name of the ship that carried the Pilgrims to
America in 1620?\nA) Mayflower\nB) Santa Maria\nC) Titanic\nD) Endeavour"
};

string[] historyAnswers = { "A", "C", "C", "A", "A" };

for (int i = 0; i < historyQuestions.Length; i++)


{
Console.WriteLine($"Question {i + 1}:
{historyQuestions[i]}");
Console.Write("Your answer: ");
string userAnswer = Console.ReadLine().ToUpper();

if (userAnswer == historyAnswers[i])
{
Console.WriteLine("Correct!");
score++;
}
else
{
Console.WriteLine($"Incorrect. The correct answer is
{historyAnswers[i]}");
}
}

DisplayResult(score);
return score;
}

static int RunMoviesQuiz()


{
Console.WriteLine("Movies Quiz");
int score = 0;

string[] moviesQuestions = {
"Who directed 'Pulp Fiction'?\nA) Quentin Tarantino\nB)
Martin Scorsese\nC) Stanley Kubrick\nD) Christopher Nolan",
"Which movie won the Academy Award for Best Picture in
1994?\nA) Forrest Gump\nB) The Shawshank Redemption\nC) Titanic\nD) Braveheart",
"Who played the role of Neo in 'The Matrix' trilogy?\nA)
Keanu Reeves\nB) Laurence Fishburne\nC) Hugo Weaving\nD) Matt Damon",
"Which animated movie features a talking snowman named
Olaf?\nA) Toy Story\nB) Shrek\nC) Frozen\nD) Moana",
"Who portrayed the character of Jack Dawson in 'Titanic'?\
nA) Brad Pitt\nB) Tom Cruise\nC) Johnny Depp\nD) Leonardo DiCaprio"
};

string[] moviesAnswers = { "A", "A", "A", "C", "D" };

for (int i = 0; i < moviesQuestions.Length; i++)


{
Console.WriteLine($"Question {i + 1}:
{moviesQuestions[i]}");
Console.Write("Your answer: ");
string userAnswer = Console.ReadLine().ToUpper();

if (userAnswer == moviesAnswers[i])
{
Console.WriteLine("Correct!");
score++;
}
else
{
Console.WriteLine($"Incorrect. The correct answer is
{moviesAnswers[i]}");
}
}

DisplayResult(score);
return score;
}

static void DisplayResult(int score)


{
if (score == 5)
{
Console.WriteLine("Ugurlu oldun! (Congratulations!)");
}
else
{
Console.WriteLine("asdf");
}
}
}
}

You might also like