简体   繁体   English

任何人都可以知道如何处理(错误 CS1525:意外符号)

[英]Can anybody know what to do to with (error CS1525: Unexpected symbol)

I'm fighting with this problem from yesterday and I don't know what is the problem.我从昨天开始就在与这个问题作斗争,我不知道是什么问题。 On my MacBook code is running without problems.在我的 MacBook 上,代码运行没有问题。 I have Visual Studio Code.我有 Visual Studio 代码。 But after action "copy and paste" to internet compiler on https://pl.spoj.com code have a crush.但是在https://pl.spoj.com代码上的“复制和粘贴”到 Internet 编译器之后,我很喜欢。 Compiler is gmcs 5.20.1 for C#. C# 的编译器是 gmcs 5.20.1。

Code: https://ideone.com/359Iuw代码: https://ideone.com/359Iuw

using System;

public class Test
{
    public static void Main()
    {
        int numberOfTests;
            int[] arrayOfNumbers = new int[100];
            string[] splittedData;
            int firstNumber, secondNumber;
            double wynik;

            // Step 1. Read and upload numbers of repetitions
            numberOfTests = TakeNumberOfTests();
            // Step 2. Calculations
            for (uint i = 0; i < numberOfTests; i++)
            {
                splittedData = PodzielBufor(PobierzBufor(),' ');
                firstNumber = TakeNumber(splittedData,1);
                secondNumber = TakeNumber(splittedData,2);
                wynik = NWW(firstNumber,secondNumber);
                Console.WriteLine("{0}",wynik);
            }


            // All functions 
            int TakeNumberOfTests()
            {
                int ans = Int.Parse(Console.ReadLine());
                return ans;
            }

            int NWD(int a, int b)
            {
                int zmiennaPomocnicza;
                while(b!=0)
                {
                    zmiennaPomocnicza = b;
                    b = a%b;
                    a = zmiennaPomocnicza;
                }
                return a;
            }

            double NWW(int a, int b)
            {
                double result;
                result = (a*b)/NWD(a,b);
                return result;
            }
            string PobierzBufor()
            {
                return Console.ReadLine(); //odczyt danych ze strumienia
            }
            string[] PodzielBufor(string inputData, char character)
            {
                string[] splittedData;
                splittedData = inputData.Split(character);
                return splittedData;
            }
            int TakeNumber(string[] dataArray,int number)
            {
                return Int32.Parse(dataArray[number-1]);
            }
    }
}

Can anybody give me advice what I need to do?有人可以给我建议我需要做什么吗?

You are using a language feature from a higher version of C# than is on the remote compiler.您正在使用比远程编译器更高版本的 C# 的语言功能。

  1. Find out what language version the online compiler supports;找出在线编译器支持的语言版本; possibly 6 or 5 if it doesn't support local functions (you may need to use trial and error if they don't make it clear)如果它不支持本地功能,可能是 6 或 5(如果它们不明确,您可能需要使用反复试验)
  2. Set the language version in your project;在你的项目中设置语言版本; now your own compiler locally will tell you if you try to use anything not supported;现在您自己的本地编译器会告诉您是否尝试使用不支持的任何内容; in new (SDK-style) csproj this is via <LangVersion>6<LangVersion> etc (in the csproj inside a property-group)在新的(SDK 样式)csproj 中,这是通过<LangVersion>6<LangVersion>等(在属性组内的 csproj 中)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误 CS1525:意外的符号“)”,需要“(”、“[”或“{” - Error CS1525: Unexpected symbol `)', expecting `(', `[', or `{' 错误CS1525:意外的符号“刚体” - Error CS1525: unexpected symbol 'rigidbody' 错误CS1525:符号&#39;{&#39;意外 - error CS1525: Unexpected symbol `{' 错误CS1525:意外的符号“转换” - error CS1525: Unexpected symbol `transform' Player.cs错误CS1525:意外符号&#39;public&#39; - Player.cs error CS1525: Unexpected symbol `public' 错误CS1525:符号&#39;?&#39;意外,期望为&#39;。&#39; 在monodevelop中 - Error CS1525: Unexpected symbol `?', expecting `.' in monodevelop Platformer脚本错误CS1525:意外的符号platformSpeed&#39;,expecting(&#39;,)&#39;、、&#39;、;&#39;,[&#39;,{&#39;或&#39; - Platformer Script error CS1525: Unexpected symbol platformSpeed', expecting(', )',,', ;',[', {', or' Unity编辑器脚本:错误CS1525:意外的符号` <internal> &#39; - Unity Editor Script: error CS1525: Unexpected symbol `<internal>' (42,18): 错误 CS1525: 意外符号 `(&#39;, 期待 `,&#39;, `;&#39;, or `=&#39; - (42,18): error CS1525: Unexpected symbol `(', expecting `,', `;', or `=' 我不断收到同样的错误,“CS1525: Unexpected symbol `string'”。 我只是找不到出错的地方 - I keep getting the same error, “ CS1525: Unexpected symbol `string' ”. I just can't find where I made an error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM