基本信息
源码名称:计算长方体的表面积、体积等。
源码大小:0.01M
文件格式:.rar
开发语言:C#
更新时间:2016-02-02
   源码介绍

一个炒鸡简单的示例,用于新手学习~

using System; 
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 长方体
{
    class Program
    {
        static void Main(string[] args)
        {
            start:
            try
            {
                int a, b, c;
                string text;
                Console.Write("计算单位:");
                text = Console.ReadLine();
                Console.Write("长:");
                a = int.Parse(Console.ReadLine());
                Console.Write("宽:");
                b = int.Parse(Console.ReadLine());
                Console.Write("高:");
                c = int.Parse(Console.ReadLine());
                int x, y, z;
                x = a * b;
                y = 2 * a * b   2 * b * c   2 * a * c;
                z = x * c;
                Console.WriteLine("底面积:"   x.ToString()   text   "2");
                Console.WriteLine("表面积:"   y.ToString()   text   "2");
                Console.WriteLine("体积:"   z.ToString()   text   "3");
                Console.WriteLine();
                goto start;
            }
            catch (Exception)
            {
                Console.Write("数据出现错误。");
                Console.WriteLine();
                goto start;
            }
        }
    }
}