CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #2
    Join Date
    Feb 2012
    Location
    Strasbourg, France
    Posts
    116

    Re: A get or set accessor required (Console Application)

    { and } missing at some places.
    Console.ReadLine()); returns a string, so you need to parse it before putting it inside an integer
    static void Main(); if you put ; here it means that you've finished implementing the function

    Code:
    namespace ConsoleApplication2
    {
        class Program
        {
            
            static void Main()
            {
                int ID;
                Console.WriteLine("Enter Username");
                string Name = Console.ReadLine();
                if (Name.ToLower() == "administrator")
                {
    
                    Console.WriteLine("Welcome System Administrator. Enter your password.");
                    if (Console.ReadLine() == "root")
                    {
                        Console.WriteLine("System Administrator logon successful!");
                    }
                    else
                    {
                        Console.WriteLine("Invalid password. Please log on as guest.");
                    }
                }
                else
                {
                    Console.WriteLine("Welcome System User. Please enter the confirmation code to confirm you are a user of the mainframe.");
                    if (Console.ReadLine() == "ibmmainframe7")
                    {
                        Console.WriteLine("Welcome System User. Please enter your ID");
                        ID = int.Parse(Console.ReadLine());
                        Console.WriteLine("Welcome system user # " + ID.ToString());
                    }
                    else
                    {
                        Console.WriteLine("Welcome System Guest!");
                    }
    
                }
    
    
                Console.ReadLine();
    
            }
        }
    }
    Last edited by Erendar; May 29th, 2012 at 09:55 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured