Help me with a program.
-
Welcome to The Quiz Program! You can be quizzed on any of the following operators: 1) % (modulus, or 'remainder') 2) * (multiplication) 3) / (integer division) 4) / % (integer division & modulus in a combined challenge! Type the number of the operator that you wish to be quizzed on: 1 I will ask you to tell me the result of A % B What is the smallest value of A: 0 What is the largest value of A: 100 What is the smallest value of B: 40 What is the largest value of B: 50 How many times do you wish to be quizzed: 3 Ok, we're ready to go! What is the result of 92 % 44? 4 4 is correct! What is the result of 92 % 48? 4 Good try, but no: 92 % 48 = 44 What is the result of 18 % 47? 47 Good try, but no: 18 % 47 = 18 Thank you for using this program - have a nice day! Press the 'Return' key to exit Here's my code I'm stuck have no idea what to do next. class Program { class DoLoop { public static void Main() { string myChoice; do { // Print A Menu Console.WriteLine("Welcome to The Quiz Program!\n You can be quizzed on any of the following operators:"); Console.WriteLine("1) % (modulus, or 'remainder')"); Console.WriteLine("2 (multiplication)"); Console.WriteLine("3 - (integer division)"); Console.WriteLine("4 - integer division & modulus in a combined challenge!)"); Console.WriteLine("Choice (1,2,3,or 4): "); // Retrieve the user's choice myChoice = Console.ReadLine(); // Make a decision based on the user's choice switch(myChoice) { case "1": Console.WriteLine("I will ask you to to tell me the result of\n A % B"); break;
-
Welcome to The Quiz Program! You can be quizzed on any of the following operators: 1) % (modulus, or 'remainder') 2) * (multiplication) 3) / (integer division) 4) / % (integer division & modulus in a combined challenge! Type the number of the operator that you wish to be quizzed on: 1 I will ask you to tell me the result of A % B What is the smallest value of A: 0 What is the largest value of A: 100 What is the smallest value of B: 40 What is the largest value of B: 50 How many times do you wish to be quizzed: 3 Ok, we're ready to go! What is the result of 92 % 44? 4 4 is correct! What is the result of 92 % 48? 4 Good try, but no: 92 % 48 = 44 What is the result of 18 % 47? 47 Good try, but no: 18 % 47 = 18 Thank you for using this program - have a nice day! Press the 'Return' key to exit Here's my code I'm stuck have no idea what to do next. class Program { class DoLoop { public static void Main() { string myChoice; do { // Print A Menu Console.WriteLine("Welcome to The Quiz Program!\n You can be quizzed on any of the following operators:"); Console.WriteLine("1) % (modulus, or 'remainder')"); Console.WriteLine("2 (multiplication)"); Console.WriteLine("3 - (integer division)"); Console.WriteLine("4 - integer division & modulus in a combined challenge!)"); Console.WriteLine("Choice (1,2,3,or 4): "); // Retrieve the user's choice myChoice = Console.ReadLine(); // Make a decision based on the user's choice switch(myChoice) { case "1": Console.WriteLine("I will ask you to to tell me the result of\n A % B"); break;
1. Enter a loop for the appropriate number of iterations
2. Post the question
3. Get the user's input
4. Compare user input to the correct result
5. Display either correct or incorrect
6. Restart the loopGlad I could help,
Sounds like somebody's got a case of the Mondays -Jeff
-
Welcome to The Quiz Program! You can be quizzed on any of the following operators: 1) % (modulus, or 'remainder') 2) * (multiplication) 3) / (integer division) 4) / % (integer division & modulus in a combined challenge! Type the number of the operator that you wish to be quizzed on: 1 I will ask you to tell me the result of A % B What is the smallest value of A: 0 What is the largest value of A: 100 What is the smallest value of B: 40 What is the largest value of B: 50 How many times do you wish to be quizzed: 3 Ok, we're ready to go! What is the result of 92 % 44? 4 4 is correct! What is the result of 92 % 48? 4 Good try, but no: 92 % 48 = 44 What is the result of 18 % 47? 47 Good try, but no: 18 % 47 = 18 Thank you for using this program - have a nice day! Press the 'Return' key to exit Here's my code I'm stuck have no idea what to do next. class Program { class DoLoop { public static void Main() { string myChoice; do { // Print A Menu Console.WriteLine("Welcome to The Quiz Program!\n You can be quizzed on any of the following operators:"); Console.WriteLine("1) % (modulus, or 'remainder')"); Console.WriteLine("2 (multiplication)"); Console.WriteLine("3 - (integer division)"); Console.WriteLine("4 - integer division & modulus in a combined challenge!)"); Console.WriteLine("Choice (1,2,3,or 4): "); // Retrieve the user's choice myChoice = Console.ReadLine(); // Make a decision based on the user's choice switch(myChoice) { case "1": Console.WriteLine("I will ask you to to tell me the result of\n A % B"); break;
OK, you're off to a start. Look up the Random class for info on generating random numbers, then read up on for/next loops for your main loop. Ask your teacher or check your course books for more info.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Welcome to The Quiz Program! You can be quizzed on any of the following operators: 1) % (modulus, or 'remainder') 2) * (multiplication) 3) / (integer division) 4) / % (integer division & modulus in a combined challenge! Type the number of the operator that you wish to be quizzed on: 1 I will ask you to tell me the result of A % B What is the smallest value of A: 0 What is the largest value of A: 100 What is the smallest value of B: 40 What is the largest value of B: 50 How many times do you wish to be quizzed: 3 Ok, we're ready to go! What is the result of 92 % 44? 4 4 is correct! What is the result of 92 % 48? 4 Good try, but no: 92 % 48 = 44 What is the result of 18 % 47? 47 Good try, but no: 18 % 47 = 18 Thank you for using this program - have a nice day! Press the 'Return' key to exit Here's my code I'm stuck have no idea what to do next. class Program { class DoLoop { public static void Main() { string myChoice; do { // Print A Menu Console.WriteLine("Welcome to The Quiz Program!\n You can be quizzed on any of the following operators:"); Console.WriteLine("1) % (modulus, or 'remainder')"); Console.WriteLine("2 (multiplication)"); Console.WriteLine("3 - (integer division)"); Console.WriteLine("4 - integer division & modulus in a combined challenge!)"); Console.WriteLine("Choice (1,2,3,or 4): "); // Retrieve the user's choice myChoice = Console.ReadLine(); // Make a decision based on the user's choice switch(myChoice) { case "1": Console.WriteLine("I will ask you to to tell me the result of\n A % B"); break;
Why do you have 500 "Console.WriteLine" ?? Well not quite 500 but jeze, you still have quite a few! Use a single string, You seem to be in a class/new to programming so I'll help you with these: 1) No need to call write line 100 time unless you need to 2) The char '\n' is bad to use in .NET unlike some other other language's the new line char '\n' doesn't get converted by the compiler to the system's correct new line format. So there is a class called "Environment" which contains a "NewLine" property (the correct way to do a '\n' in .NET) which will decode to the correct new line string.
Console.WriteLine("Welcome to The Quiz Program!{0}" + " You can be quizzed on any of the following operators:{0}" + "\\t1) %\\t(modulus, or 'remainder'){0}" + "\\t2) \*\\t(multiplication){0}" + "\\t3) /\\t(integer division){0}" + "\\t4) /%\\t(integer division & modulus in a combined challenge!)" + "{0}{0}Choice (1,2,3,or 4):", Environment.NewLine);
-Spacix All your skynet questions[^] belong to solved