1. using System;
  2. class Program
  3. {
  4. static void Main()
  5. {
  6. Console.WriteLine("Welcome to the Greeting Program!");
  7. Console.Write("Please enter your name: ");
  8. // Read user input
  9. string userName = Console.ReadLine();
  10. // Greet the user
  11. Console.WriteLine($"Hello, {userName}! Welcome to C# programming.");
  12. // Keep the console window open until a key is pressed
  13. Console.WriteLine("\nPress any key to exit...");
  14. Console.ReadKey();
  15. }
  16. }
 
 

108

Pasted Text #34501

The C# code provided is a simple console application that prompts the user for their name, greets them with a personalized message, and waits for any key press before exiting.

PasteBin

行数
20
词数
56
文件大小
526 字节
创建于
类型
text/x-csharp
All Rights Reserved ((C))
登录后发言!