算术运算符在编译时不会注册

时间:2017-06-26 11:17:02

标签: c# c#-4.0

刚刚开始学习c#,我在运行控制台应用程序时遇到了一些麻烦。出于某种原因,当我运行控制台应用程序时,它运行sayHello方法,但不会运行Arithmetic方法。

任何帮助将不胜感激。

using System;

class Mainclass {

public static void sayHello(string username, string servername)
{

    Console.WriteLine("Could you please enter your name : ");

    username = Console.ReadLine();
    Console.WriteLine("Hello " + username + "," + " my name is " + servername + ".");
    Console.ReadLine();
}

public static float Arithmetic (float value)
{


    return value * value;
}




static void Main()
{
    Console.WriteLine("Hello, Welcome to the football scout app.");

    sayHello((Console.ReadLine()), "Mr. Scout");

    Arithmetic(200);

}

1 个答案:

答案 0 :(得分:3)

当然 运行该方法,您只是没有实现任何输出。

static void Main()
{
    Console.WriteLine("Hello, Welcome to the football scout app.");

    sayHello((Console.ReadLine()), "Mr. Scout");

    Console.WriteLine("200 squared equals " + Arithmetic(200).ToString());
}