Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8390099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:53:50+00:00 2026-06-09T18:53:50+00:00

How do I make this program continue running after the user selects an option?

  • 0

How do I make this program continue running after the user selects an option? Here is the code I have so far.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace calculator_extended
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Press A for addition");
            Console.WriteLine("Press S for subtraction");
            Console.WriteLine("Press M for Multiplication");
            Console.WriteLine("Press D for Divide");

            char c = Convert.ToChar(Console.ReadLine());

            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());

            switch (c)
            {
                case 'A':
                case 'a':
                    {
                        int d = add(a, b);
                        Console.WriteLine(d);
                        break;


                    }


                case 'S':
                case 's':
                    {
                        int d = sub(a, b);
                        Console.WriteLine(d);
                        break;
                    }

                case 'M':
                case 'm':
                    {
                        int d = mul(a, b);
                        Console.WriteLine(d);
                        break;
                    }

                case 'E':
                case 'e':
                    {
                        int d = div(a, b);
                        Console.WriteLine(d);
                        break;
                    }
                default:
                    {

                        Console.WriteLine("Please Enter the correct Character");
                        break;
                    }


            }
        }
            private static int add(int a, int b)
    {

                   return a + b;
    }
               private static int sub(int a, int b)
    {

                   return a - b;
    }
               private static int mul(int a, int b)
    {
                   return a * b;
    }
               private static int div(int a, int b)
    {

                   return a / b;
    }

        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:53:52+00:00Added an answer on June 9, 2026 at 6:53 pm

    Wrap your code with

    while(true) {
        // Your code here
    
        // Don't forget to add a switch case for an Exit operation
        case 'q':
            Application.Exit();
    }
    

    If you’re new to programming, you should look into Loops – See Listing 4-2 – it’s a good example of what you’re trying to accomplish.

    EDIT:
    I realize you’re new to programming and I do think you should accomplish this by your own.
    As it’s a basic problem, here’s a full solution

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace calculator_extended
    {
        class Program
        {
            static void Main(string[] args)
            {
                int d = 0;
    
                while (true)
                {
                    Console.WriteLine("Press A for addition");
                    Console.WriteLine("Press S for subtraction");
                    Console.WriteLine("Press M for Multiplication");
                    Console.WriteLine("Press D for Divide");
    
                    char c = Convert.ToChar(Console.ReadLine());
    
                    int a = Convert.ToInt32(Console.ReadLine());
                    int b = Convert.ToInt32(Console.ReadLine());
    
                    switch (c)
                    {
                        case 'A':
                        case 'a':
                            d = add(a, b);
                            Console.WriteLine(d);
                            break;
                        case 'S':
                        case 's':
                            d = sub(a, b);
                            Console.WriteLine(d);
                            break;
                        case 'M':
                        case 'm':
                            d = mul(a, b);
                            Console.WriteLine(d);
                            break;
                        case 'E':
                        case 'e':
                            d = div(a, b);
                            Console.WriteLine(d);
                            break;
                        case 'q':
                        case 'Q':
                            Application.Exit();
                        default:
                            Console.WriteLine("Please Enter the correct Character");
                            break;
                    }
                }
            }
            private static int add(int a, int b)
            {
    
                return a + b;
            }
            private static int sub(int a, int b)
            {
    
                return a - b;
            }
            private static int mul(int a, int b)
            {
                return a * b;
            }
            private static int div(int a, int b)
            {
    
                return a / b;
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this program I am trying to make, I have an expression (such as
OK, in this program I am required to make a table based of user
I used the continue statement to make this simple program and got the desired
I make this program :: #include<stdio.h> char *raw_input(char *msg); main() { char *s; *s
I make this php program to access mysql data foreach ($arrayOfID as $ID) {
I am trying to make this sample program work (defn foo ([x] (foo x
Trying to make a simple program to catalogue books. Something like this, for example:
Trying to make a simple program to catalogue books. Something like this, for example:
Ok, I want to make my program print out the date: 1/1/2009 But this
To make this more clear, I'm going to put code samples: $file = fopen('filename.ext',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.