Question

for my assignment, we have to create a basic quiz on c sharp using visual studio,...

for my assignment, we have to create a basic quiz on c sharp using visual studio, i have my questions, gotten the score calculated if answered correct or not. but in having issues with looping back to the question until answered right.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

In case of any query do comment. Please rate answer as well. Thanks

Code:

using System;

namespace Quiz
{
class Program
{
static void Main(string[] args)
{
//Let's say you have two numbers and in the quiz you want to add them
int number1 = 15, number2 = 25, expectedAnswer=0, givenAnswer=0;

//so we know the expected answer
expectedAnswer = number1 + number2;
//We will use do-while loop which will run until given answer is not equal to expected answer
do
{
Console.Write("What is {0} + {1} = ", number1, number2);
givenAnswer = int.Parse(Console.ReadLine());

} while (givenAnswer != expectedAnswer); //this while condition will loop until you answered corectly

// to keep the console alive to see output
Console.Write("Press any key to continue...");
Console.ReadKey();
}
}
}

============screen shot of the code=========

Output:

Add a comment
Know the answer?
Add Answer to:
for my assignment, we have to create a basic quiz on c sharp using visual studio,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C# Sharp for Visual Studio Need Expert help -to use Video studio to write a Quiz....

    C# Sharp for Visual Studio Need Expert help -to use Video studio to write a Quiz. The quiz is multiple choice with 10 questions. I need a source code to start and I can copy and paste my questions. EX: using System; namespace Quiz     class MainClass     {         public static void Main(string[] args)         {         Console.WriteLine("Welcome to the Quiz!");             Console.WriteLine("");                 // Declare variables implicitly and explicitly             var Question 1= "How many trees in a forest?");                var Answer1a = "3"                    var Answer1b ="5"...

  • ASP.Net For this exercise, Create a short online quiz. Make sure the quiz has at least...

    ASP.Net For this exercise, Create a short online quiz. Make sure the quiz has at least 3 questions and that each question has at least 3 possible answers. After the questions there should be a button web control that will display the users score. The correct answer should be shown for the ones the user get incorrect. This needs to be done on visual studio using visual basic programming

  • C #sharp Visual Studio Programming, Implement the array declaration and initialization for -For this quiz I...

    C #sharp Visual Studio Programming, Implement the array declaration and initialization for -For this quiz I attached (EXAMPLE of 10 questions).... Using arrays to format this quiz? using System; namespace Quiz {     class MainClass     {         public static void Main(string[] args)         {             Console.WriteLine("Welcome to the Quiz!");             Console.WriteLine("--------------------------------");             Console.WriteLine(" ");             //Questions                       var Question1 = "1. How many trees in a forest?";             var Question2 = "2. Sample Question";             var Question3 =...

  • : LP 4: Assignment 4 - Penny or Nickel Challenge in visual basic 2017, I am...

    : LP 4: Assignment 4 - Penny or Nickel Challenge in visual basic 2017, I am stuck need help on form and code in c++ this is for practice to get my right form and coding to be able to do my in-class assignment. The instructor said to perfect this and when we did class program we will be able to do it all. Oh hello, I am struggling on getting it right especially looping. Thank you, your answer may...

  • •Create a project in Visual Studio (C++) •Have a function that compares two C-Strings (similar to...

    •Create a project in Visual Studio (C++) •Have a function that compares two C-Strings (similar to strcmp) •Have a function that copies one string to another string (strcpy) •Have a function that returns a persons first name only •I enter Bobby Loneker to the system, this function should cut my last name off •Have a function that returns a C-string backwards •I enter Bobby to the system it returns: ybboB

  • Hey there, I am having a hard time using GUI for c# in visual studio. I...

    Hey there, I am having a hard time using GUI for c# in visual studio. I am making an alarm clock. I have a few questions that I would like to know how to do: --using a button called set time to capture text from a box containing a user-inputted hour, minute, second, and setting the current time to that. --using a button called alarm, Capture the Text in the TextBoxes - the Hours, Minutes, Seconds and Text (am/pm) and...

  • This is for my Computer Programming class using Visual Studio C++ This is a home work...

    This is for my Computer Programming class using Visual Studio C++ This is a home work assignment and is for a grade so answer seriously and if you don't know know or unsure don't answer I need the coding so i can copy and paste and need a screen shot of the result i can copy as well Thank You. P1 – Merge two sorter arrays (80 points) (a) Write a function that receive two sorted arrays of integers and...

  • So I am creating a 10 question quiz in Microsoft Visual Studio 2017 (C#) and I...

    So I am creating a 10 question quiz in Microsoft Visual Studio 2017 (C#) and I need help editing my code. I want my quiz to clear the screen after each question. It should do one question at a time and then give a retry of each question that was wrong. The right answer should appear if the retry is wrong. After the 1 retry of each question, a grade should appear. Please note and explain the changes you make...

  • The questions below deal with Microsoft Visual Studio 2012 Reloaded, under the Visual Basic programming language....

    The questions below deal with Microsoft Visual Studio 2012 Reloaded, under the Visual Basic programming language. The book ISBN number that I am using is: 978-1-285-08416-9 or the UPC code is: 2-901285084168-1. Question 1 Visual Basic 2012 is an object-oriented programming language, which is a language that allows the programmer to use ____________________ to accomplish a program�s goal. Question 2 An application that has a Web user interface and runs on a server is called a(n) ____________________ application. Question 3...

  • USING VISUAL BASIC STUDIO PLEASE PROVIDE THE CODE IN C# LANGUAGE SELECT CONSOLE APPLICATION You are...

    USING VISUAL BASIC STUDIO PLEASE PROVIDE THE CODE IN C# LANGUAGE SELECT CONSOLE APPLICATION You are to create a House with 2 rooms in the house. The following is an example of C++ code for the basic classes: **in C#, it may be written differently** class Room { private: double L; double W; public: //functions go here. } class House { private: Room room1; Room room2; public: //functions go here } The code above is C++ version. In C#, you...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT