The HelloWorld app showed you how to make a simple app that uses static data.  Here is an app that prompts for user input.  Same concept just a few more lines!
// Directive
using System;
using System.Collections.Generic;
using System.Linq; // Remove if being used in Visual C# 2005
using System.Text;
namespace HelloUser
{
   class Program
   {
      // Main Method
      static void Main(string[] args)
      {
         // Data Members
         string strTitle = "Hello User 1.0"; // Set string value
         string strInput; // Declare variable
         Console.Title = strTitle; // Set console title
         Console.Write("Enter your first name: "); // Prompt for input
         strInput = Console.ReadLine();  // Read user input
         Console.WriteLine("Hello " + strInput); // Write line of text
         Console.ReadLine(); // Read line of text
      }
   }
}
Visual c# 2008 Hello User Console App...
Posted by
Samson J. Loo
Sunday, September 14, 2008
at
9:13 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment