using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace C3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入半径:");
Ccirle a = new Ccirle();
a.r = int.Parse(Console.ReadLine());
//Console.WriteLine("底面积为:{0}", a.s);
Console.WriteLine("请输入高:");
a.h = int.Parse(Console.ReadLine());
//Console.WriteLine("圆柱体的体积为:{0}/n 圆锥的体积为:{1}", a.volumn, a.zvolumn);
}
}
interface IPlane
{
int Perimeter();
int Area();
}
interface ISolid
{
int Volume();
}
class Ccirle:IPlane,ISolid
{
public int r;
public int l;
public int s;//面积
public int h;
public int volumn;//圆柱体积
public int zvolumn;//圆锥体积
public void Perimeter()//周长
{
l = (int)(Math.PI * (2 * r));
}
public void Area()//面积
{
s = (int)(Math.PI * r * r);
Console.WriteLine("底面积为:{0}", a.s);
}
public void Volume()//体积
{
volumn = (int)(Math.PI * r * r * h);
zvolumn = (int)((Math.PI * r * r * h) / 3);
Console.WriteLine("圆柱体的体积为:{0}/n 圆锥的体积为:{1}", a.volumn, a.zvolumn);
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace C3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入半径:");
Ccirle a = new Ccirle();
a.r = int.Parse(Console.ReadLine());
//Console.WriteLine("底面积为:{0}", a.s);
Console.WriteLine("请输入高:");
a.h = int.Parse(Console.ReadLine());
//Console.WriteLine("圆柱体的体积为:{0}/n 圆锥的体积为:{1}", a.volumn, a.zvolumn);
}
}
interface IPlane
{
int Perimeter();
int Area();
}
interface ISolid
{
int Volume();
}
class Ccirle:IPlane,ISolid
{
public int r;
public int l;
public int s;//面积
public int h;
public int volumn;//圆柱体积
public int zvolumn;//圆锥体积
public void Perimeter()//周长
{
l = (int)(Math.PI * (2 * r));
}
public void Area()//面积
{
s = (int)(Math.PI * r * r);
Console.WriteLine("底面积为:{0}", a.s);
}
public void Volume()//体积
{
volumn = (int)(Math.PI * r * r * h);
zvolumn = (int)((Math.PI * r * r * h) / 3);
Console.WriteLine("圆柱体的体积为:{0}/n 圆锥的体积为:{1}", a.volumn, a.zvolumn);
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货