C# 我不断得到错误';CS1513:}预期为';在我的节目上
这是我的密码。当我运行这段代码时,它一直给我错误“CS1513:}预期”。我的代码有什么问题?如果这是您的完整程序,那么您在结尾处缺少三个C# 我不断得到错误';CS1513:}预期为';在我的节目上,c#,C#,这是我的密码。当我运行这段代码时,它一直给我错误“CS1513:}预期”。我的代码有什么问题?如果这是您的完整程序,那么您在结尾处缺少三个一个关闭Main方法一个关闭程序类和一个关闭控制台应用程序3命名空间。还有一个。} 编译器需要一个未找到的右大括号(}) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; nam
一个关闭Main
方法一个关闭程序
类和一个关闭控制台应用程序3
命名空间。还有一个在出现错误的if
语句后添加code>。}
编译器需要一个未找到的右大括号(})
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int age = Convert.ToInt32(Console.ReadLine());
if (age > 18) ;
Console.WriteLine("Welcome!");
else
Console.WriteLine("You are too young!");
您有多少开放式括号,需要关闭它们。对于上面的代码,在其末尾添加以下内容
// CS1513
namespace y // CS1513, no close curly brace
{
class x
{
public static void Main()
{
}
}
}
在(年龄>18岁)分号无效后移除分号。
}}}