using System;
class Circle
{
//public int x;
//public int y;
public double radius;

public  double Area()
{
double theArea;
theArea = 3.14159*radius*radius;

Console.WriteLine("{0}",theArea);
return theArea;
}
public double Circumference()
{
double theCircumference;
theCircumference = 3.14159*2*radius;
return theCircumference;
}
}
class myApp
{
public static void Main()
{
Circle circle = new Circle ();
Console.WriteLine("Please inter the Number and press the ENTER:");
circle.radius = Console.Read();
circle.Area ();

}
}

解决方案 »

  1.   

    circle.radius = Convert.ToDouble(Console.ReadLine());
      

  2.   

    Console.Read();返回的是一个整数..
      

  3.   

    能给小第讲详细点么?谢谢,还有,找这方面的资料去那里找啊?Console.Read();和
    Convert.ToDouble(Console.ReadLine());
      

  4.   


    MSDN没有类似于
    Console.Read();返回的是一个整数..
    有么?
      

  5.   

    Console.Read方法
    返回值
    输入流中的下一个字符;或者如果没有更多的可用字符,则为负一 (-1)。异常
    异常类型 条件 
    IOException 出现 I/O 错误。 备注
    此方法直到读取操作终止(例如,用户按下 Enter 键)后才会返回。如果数据可用,则输入流包含用户输入的内容,末尾附加依赖于环境的换行符。Console.Readline方法
    返回值
    输入流中的下一行;或者如果没有更多的可用字符,则为空引用(Visual Basic 中为 Nothing)。异常
    异常类型 条件 
    IOException 出现 I/O 错误。 
    OutOfMemoryException 内存不足,无法为返回的字符串分配缓冲区。 备注
    行被定义为后跟回车符(十六进制 0x000d)、换行符(十六进制 0x000a)或 Environment.NewLine 的字符序列。返回的字符串不包含终止字符。如果此方法引发 OutOfMemoryException,则读取器在基础 Stream 的位置会前移若干字符,前移的字符数就是该方法能够读取的字符数,但是会放弃已经读入内部 ReadLine 缓冲区的字符。因为无法更改读取器在流中的位置,所以已经读取的字符是无法恢复的,只能通过重新初始化 TextReader 来访问这些字符。如果流内的初始位置未知,或者流不支持查找,则也需要重新初始化基础 Stream。
      

  6.   

    public static int Read ()
    看下MSDN:ms-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.NETDEVFX.v20.chs/cpref2/html/M_System_Console_Read.htmMSDN上讲得已很清楚了,MSDN是个好东西啊,多看看没坏处..^_^
      

  7.   

    gao 2搞定了,谢谢!汗!怪我太懒了。其实细心一找就找到了。
      

  8.   

    再请教个问题,就是怎么把图片设置成背景呢?
    图片是 tb.jpg  我这个老出现异常。
    using System; 
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;public class frmApp : Form
    {
    public static void Main(string []args)
    {
    frmApp myForm = new frmApp ();

    // System.Reflection.Assembly thisExe;
    // thisExe = System.Reflection.Assembly.GetExecutingAssembly();
    // System.IO.Stream file = thisExe.GetManifestResourceStream("tb.jpg");
    // Image imgChessboard = System.Drawing.Image.FromStream(file); 
    //


    Image file = System.Drawing.Image.FromFile("tb.jpg"); myForm.Text = "Form4-Backgrounds";
    myForm.BackgroundImage = Image.FromFile("tb.jpg"); Size tmpSize = new Size (); tmpSize.Width = myForm.BackgroundImage.Width;
    tmpSize.Height = myForm.BackgroundImage .Height ;
    Application.Run(myForm);
    }
    }