Reputation: 3
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. I have Visual Studio Code. But after action "copy and paste" to internet compiler on https://pl.spoj.com code have a crush. Compiler is gmcs 5.20.1 for C#.
Code: 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?
Upvotes: 0
Views: 1185
Reputation: 1062520
You are using a language feature from a higher version of C# than is on the remote compiler.
<LangVersion>6<LangVersion>
etc (in the csproj inside a property-group)Upvotes: 1