Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
AnswerRe: SortedList, Key as element of Value Pin
Kythen13-May-09 9:31
Kythen13-May-09 9:31 
QuestionC# Console Application Pin
bigjoe11a13-May-09 7:49
bigjoe11a13-May-09 7:49 
AnswerRe: C# Console Application Pin
Jimmanuel13-May-09 8:10
Jimmanuel13-May-09 8:10 
GeneralRe: C# Console Application Pin
bigjoe11a13-May-09 8:17
bigjoe11a13-May-09 8:17 
GeneralRe: C# Console Application Pin
Jimmanuel13-May-09 8:38
Jimmanuel13-May-09 8:38 
GeneralRe: C# Console Application Pin
bigjoe11a13-May-09 10:00
bigjoe11a13-May-09 10:00 
GeneralRe: C# Console Application Pin
Jimmanuel13-May-09 11:33
Jimmanuel13-May-09 11:33 
GeneralRe: C# Console Application Pin
OriginalGriff13-May-09 8:43
mveOriginalGriff13-May-09 8:43 
Rule 1: Use the "code block" button below to preserve formatting. It makes things easier to read.
Rule 2: unless you are a seriously experienced programmer and there is a very good reason, do not use goto. It will earn you nothing but grief and abuse here.
Rule 3: Learn about loops. Learn about data types. Learn at least the basics of C#.
Rule 4: Learn there is a difference between "Console" and "Terminal" (one exists, the other doesn't)

Having said that, I'm in a good mood:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Demo
    {
    class Program
        {
        static void Main(string[] args)
            {
            string name;
            Console.Write("Enter your name: ");
            name = Console.ReadLine();

            Console.WriteLine("\nWelcome : " + name);
            Console.WriteLine("1) Game Menu");
            Console.WriteLine("2) List Users");
            Console.WriteLine("3) Help");
            Console.WriteLine("9) Quit");
            Console.Write("Choice : (1,2,3 or 9) ");
            int i = 0;
            do
                {
                string s = Console.ReadLine();
                if (s == "")
                    {
                    continue;
                    }
                i = s[0];
                switch (i)
                    {
                    case '1':
                        Console.WriteLine("Game selected");
                        // Handle game.
                        break;
                    case '2':
                        Console.WriteLine("List selected");
                        // List users
                        break;
                    case '3':
                        Console.WriteLine("Help selected");
                        // Help
                        break;
                    case '9':
                        Console.WriteLine("Quit selected");
                        break;
                    default:
                        Console.WriteLine("Invalid Key");
                        break;
                    }
                }
            while (i != '9');
            }
        }
    }


This is not perfect (I threw it together from your code), but it has the advantage of working...
Now, for your homework, please post a complete explaination of how it works.

No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.

This message is made of fully recyclable Zeros and Ones

GeneralRe: C# Console Application Pin
bigjoe11a13-May-09 10:26
bigjoe11a13-May-09 10:26 
GeneralRe: C# Console Application Pin
OriginalGriff13-May-09 22:24
mveOriginalGriff13-May-09 22:24 
GeneralRe: C# Console Application Pin
bigjoe11a14-May-09 4:12
bigjoe11a14-May-09 4:12 
GeneralRe: C# Console Application Pin
OriginalGriff14-May-09 4:31
mveOriginalGriff14-May-09 4:31 
GeneralRe: C# Console Application Pin
bigjoe11a14-May-09 4:39
bigjoe11a14-May-09 4:39 
GeneralRe: C# Console Application Pin
OriginalGriff14-May-09 4:48
mveOriginalGriff14-May-09 4:48 
GeneralRe: C# Console Application Pin
bigjoe11a14-May-09 4:53
bigjoe11a14-May-09 4:53 
Questiondatagrid scroll Pin
michaelgr113-May-09 7:29
michaelgr113-May-09 7:29 
AnswerRe: datagrid scroll Pin
Dave Kreskowiak13-May-09 8:59
mveDave Kreskowiak13-May-09 8:59 
QuestionWindows resizing Pin
michaelgr113-May-09 7:06
michaelgr113-May-09 7:06 
AnswerRe: Windows resizing Pin
musefan13-May-09 7:10
musefan13-May-09 7:10 
AnswerRe: Windows resizing Pin
Giorgi Dalakishvili13-May-09 7:11
mentorGiorgi Dalakishvili13-May-09 7:11 
QuestionAppDomain Pin
humayunlalzad13-May-09 6:42
humayunlalzad13-May-09 6:42 
AnswerRe: AppDomain Pin
musefan13-May-09 6:58
musefan13-May-09 6:58 
GeneralRe: AppDomain Pin
Rajdeep.NET is BACK13-May-09 7:25
Rajdeep.NET is BACK13-May-09 7:25 
GeneralRe: AppDomain Pin
humayunlalzad13-May-09 7:26
humayunlalzad13-May-09 7:26 
GeneralRe: AppDomain Pin
Luc Pattyn13-May-09 7:32
sitebuilderLuc Pattyn13-May-09 7:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.