gpt-3.5-turbo-0613· openai
Suzhen/CodeChat
c sharp coding for quix application
- User
c sharp coding for quix application
- Assistant
Here is an example of C# code for a simple quiz application:
using System; class QuizApplication { static void Main() { string[] questions = { "Q1. What is the capital city of France?", "Q2. What is the largest planet in our solar system?", "Q3. Who painted the Mona Lisa?", "Q4. Which animal is known as the 'King of the Jungle'?" }; string[] options = { "a. Paris b. Madrid c. London d. Rome", "a. Venus b. Mars c. Jupiter d. Saturn", "a. Van Gogh b. Picasso c. Leonardo da Vinci d. Michelangelo", "a. Lion b. Elephant c. Tiger d. Giraffe" }; string[] answers = { "a", "c", "c", "a" }; int score = 0; Console.WriteLine("Welcome to the Quiz Application!"); for (int i = 0; i < questions.Length; i++) { Console.WriteLine("\n" + questions[i]); Console.WriteLine(options[i]); Console.Write("\nEnter your answer: "); string userAnswer = Console.ReadLine(); if (userAnswer == answers[i]) { Console.WriteLine("Correct!"); score++; } else { Console.WriteLine("Incorrect!"); } } Console.WriteLine("\nQuiz completed!"); Console.WriteLine("Your score: " + score + "/" + questions.Length); } }