小编L33*_*ePK的帖子

为什么我的c#程序不会运行?

我是一名刚开始学习c#的单身学生.我确信有一个简单的解决方案,但我已经搜索过,我认为还不够.这是我的程序,注意我还没有完成一些功能.

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            public void welcome()
            {
            Console.WriteLine("Fuel Consumption Calculator "+"r/n"+"Are you using Metric 1 or Imperial 2 ?");
            }


            public void check()
            {
                string choice;
                choice = Console.ReadLine();
                if (choice == "1")
                {
                    calcmetric();
                }
                else
                {
                    calcimperial();
                }

            }
             public void calcmetric()
             {
             }
            public void calcimperial()
             {
             }
        }

    }
}
Run Code Online (Sandbox Code Playgroud)

在Visual Studio中,我有两个错误:一个在预期后会出现'}' Main; 并且在最后说"类型或命名空间定义错误"时出错.

c#

-5
推荐指数
1
解决办法
136
查看次数

标签 统计

c# ×1