Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- namespace Frågesprotspel
- {
- //namnet på programmet.
- class Program
- {
- //start på programmet
- static void Main(string[] args)
- {
- //String säger vad rätt svar är.
- string answer1 = "lbs";
- string answer2 = "200";
- string answer3 = "t";
- string answer4 = "a";
- string answer5 = "45";
- //userInput sparar datan som personer skriver in.
- string userInput1;
- string userInput2;
- string userInput3;
- string userInput4;
- string userInput5;
- string userInput6;
- string userInput7;
- int correctAnswer = 0;
- int sec = 1500;
- //Alla frågot ligger i dessa regions under.
- #region
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine(" Score : {0}", correctAnswer);
- //Säger till vad du ska göra
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.Write(" Answer the following questions. OBS: ALL LOWER CASE!");
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("");
- //första frågan
- Console.WriteLine("What is the name of the school this quiz was made in?");
- //kollar vad du skriver om sparar det
- userInput1 = Console.ReadLine().ToLower();
- // if = om du skriver rätt så händer det inom den
- if (userInput1 == answer1)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Correct! You have gained one point!");
- //correctAnswer ger dig ett poäng som sparas i en int variabel.
- correctAnswer++;
- Thread.Sleep(sec);
- Console.Clear();
- }
- //Else = vad som händer om du svarar fel
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("False! The correct answer is {0}!", answer1);
- Thread.Sleep(sec);
- Console.Clear();
- }
- #endregion
- #region
- Console.ForegroundColor = ConsoleColor.White;
- // andra frågan
- Console.WriteLine("What do you get if you add 100 + 100?");
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine(" Score : {0}", correctAnswer);
- Console.ForegroundColor = ConsoleColor.White;
- userInput2 = Console.ReadLine().ToLower();
- if (userInput2 == answer2)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Correct! You have gained one point!");
- //correctanswer ger dig ett poäng och sparar det i en int variabel.
- correctAnswer++;
- Console.ForegroundColor = ConsoleColor.White;
- //Thread stoppar programmet för 1.5 sec för att kunna läsa texten.
- Thread.Sleep(sec);
- //console.clear tar bort texten innan nästa fråga börjar.
- Console.Clear();
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("False! The correct answer is {0}!", answer2);
- Thread.Sleep(sec);
- Console.Clear();
- }
- #endregion
- #region
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine(" What is the 20th letter in the alphabet?");
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine(" Score : {0}", correctAnswer);
- Console.ForegroundColor = ConsoleColor.White;
- userInput3 = Console.ReadLine().ToLower();
- if (userInput3 == answer3)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Correct! You have gained one point!");
- correctAnswer++;
- Thread.Sleep(sec);
- Console.Clear();
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine(" False! The correct answer is {0}", answer3);
- Thread.Sleep(sec);
- Console.Clear();
- }
- #endregion
- #region
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("What is the first letter in my name?");
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine(" Score : {0}", correctAnswer);
- Console.ForegroundColor = ConsoleColor.White;
- userInput4 = Console.ReadLine().ToLower();
- if (userInput4 == answer4)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Correct! You got a point!");
- correctAnswer++;
- Thread.Sleep(sec);
- Console.Clear();
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("False! The correct answer is {0}", answer4);
- Thread.Sleep(sec);
- Console.Clear();
- }
- #endregion
- #region
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("What is the answer to this? (10x2)2+5= ");
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine(" Score : {0}", correctAnswer);
- Console.ForegroundColor = ConsoleColor.White;
- userInput5 = Console.ReadLine().ToLower();
- if (userInput5 == answer5)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Correct! You got a point!");
- correctAnswer++;
- Thread.Sleep(sec);
- Console.Clear();
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("False! The correct answer is {0}", answer5);
- Thread.Sleep(sec);
- Console.Clear();
- }
- #endregion
- Console.WriteLine();
- //Skriver ut hur många poäng du fick totalt.
- Console.ForegroundColor = ConsoleColor.Blue;
- Console.WriteLine(" Amout of point : {0} ", correctAnswer);
- //console.Readkey används hör att hålla CMD öppen.
- Console.WriteLine("-------------------------------------------------------------------------------");
- Thread.Sleep(sec);
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("Would you like to make a bet? With all your points as the bet?.");
- Console.WriteLine("If you win you gain 10, But if you were to lose, You lose it ALL.");
- Console.WriteLine("Does it sound like a fair deal? ");
- Console.WriteLine("Reply with yes or no depending on what you choose.");
- userInput6 = Console.ReadLine().ToLower();
- if (userInput6 == "yes")
- {
- Console.WriteLine("Well here we go then! Let us do this.");
- Thread.Sleep(sec);
- Console.WriteLine("");
- Console.WriteLine("The question is simple. Who taught me how to do this?");
- Console.WriteLine("And with this I mean, Programming, Who taught me?");
- userInput7 = Console.ReadLine().ToLower();
- if (userInput7 == "josef")
- {
- Console.WriteLine("");
- Console.WriteLine("You are a smart man, You were right and won the bet.");
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("You will be rewarded 10 points, Congratulations. Enjoy the victory!");
- Thread.Sleep(sec);
- Console.WriteLine("Your total amout of points are : {0}", correctAnswer + 10);
- }
- else
- {
- Console.WriteLine("");
- Console.WriteLine("Ouch! That was the wrong answer. I am sorry you have lost.");
- Console.WriteLine("This means you are going to lose all of your points. Well Fought.");
- Thread.Sleep(sec);
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("All of your points have now been moved. GAME OVER.");
- Console.WriteLine("Your total amout of points are: {0}", correctAnswer - correctAnswer);
- }
- }
- else
- {
- Console.WriteLine("Well maybe it was for the best, maybe you are not smart enough.");
- Console.WriteLine("Anyways it was fun playing you. You fought well.");
- Console.WriteLine("");
- Console.WriteLine("You total amout of points are : {0}", correctAnswer);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement