Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Help me with a program.

Help me with a program.

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alex501
    wrote on last edited by
    #1

    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;

    S C S 3 Replies Last reply
    0
    • A Alex501

      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;

      S Offline
      S Offline
      Skippums
      wrote on last edited by
      #2

      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 loop

      Glad I could help,

      Sounds like somebody's got a case of the Mondays -Jeff

      1 Reply Last reply
      0
      • A Alex501

        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;

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        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 )

        1 Reply Last reply
        0
        • A Alex501

          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;

          S Offline
          S Offline
          Spacix One
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups