/*
* Created by SharpDevelop.
* User: Administrator
* Date: 2011-7-12
* Time: 7:42
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections;
namespace test
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("What’s your name? ");
string name = Console.ReadLine();
Console.WriteLine("Enter your age please: ");
int age = int.Parse(Console.ReadLine());
Console.WriteLine("Marry Christmas! {0}",name);
Console.WriteLine("You'll be {0}, next year!",age+1);
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}
1. 控制台应用程序: 输入
要求程序运行时屏幕显示效果为:
Merry Christmas !
2. 输出编程做以下:
- 输出:What’s your name?
- 读取用户输入的name
- 输出:
Merry Christmas! …(name)
3. 类型转换函数Convert.ToType()
Convert Exercise-3 (使用两种输出的方法实现)
编程做以下:
- 输出:Enter your age please:
- 读取用户输入的年龄
- 输出:
You’ll be … next year.