- int.Parse(String);
檔案 → 新增專案 → 主控台應用程式 → 撰寫 Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Lesson_A._2 { class Program { static void Main(string[] args) { string Name; int Age; Console.WriteLine("What's your name?"); Name = Console.ReadLine(); Console.WriteLine("\nHow old are you?"); Age = int.Parse(Console.ReadLine()); Console.WriteLine("\nYou are {0} and {1} years old.", Name, Age); Console.ReadLine(); } } }
沒有留言:
張貼留言