1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace ConsoleApplication4
7 {
8 class Program
9 {
10 static void Main(string[] args)
11 {
12 //通过圆的半径求圆的面积
13 double r, s;
14 Console.WriteLine("1.请输入圆的半径r:");
15 r=Convert.ToDouble(Console.ReadLine());//从终端上取半径r的值,并把它转化为双精度格式
16 s = 3.14 * r*r;
17 Console.WriteLine("圆的面积S="+s);
18 //关于字符的ASCII转化
19 string x;
20 int y;
21 Console.WriteLine("2.想知道贵姓的ASCII码吗?");
22 Console.WriteLine("请输入你的姓:");
23 x = Console.ReadLine();//从终端读取x是字符;
24 y = Convert.ToChar(x);//将x转化为ASCII码并赋予y;
25 Console.WriteLine(x+"的ASCII码是:" + y);
26 }
27 }
28 }
![roy roy](http://pic.yupoo.com/shwdr_v/Cg7UJmxv/ap2Hq.png)