在vs上运行成功,想知道为什么pta上编译错误
这是源地址
PTA | 程序设计类实验辅助教学平台
千名教师建设,万道高质量题目,百万用户拼题的程序设计实验辅助教学平台
https://pintia.cn/problem-sets/1446683633108578304/problems/1446746440437002240
代码在下面
using System;
namespace dierge
{
class LinkNodeclass
{
public LinkNode head = new LinkNode();
public class LinkNode
{
public int data;
public LinkNode next;
}
public void CreateListF(string[] split)
{
LinkNode s;
int i;
head.next = null;
for (i = 1; i < split.Length - 1; i++)
{
s = new LinkNode();
s.data = int.Parse(split[i]);
s.next = head.next;
head.next = s;
}
}
public bool GetElem(int i,ref int e)
{
int j = 0;
if (i < 1) return false;
LinkNode p = head;
while (j < i && p != null)
{
j++; p = p.next;
}
if (p == null)
return false;
else
{
e = p.data;
return true;
}
}
}
class Program
{
static void Main(string[] args)
{
string s = Console.ReadLine();
string[] ssplit = s.Split(" ");
int q = int.Parse(ssplit[0]);
LinkNodeclass pa = new LinkNodeclass();
pa.CreateListF(ssplit);
int p = 0;
pa.GetElem(q,ref p);
Console.WriteLine("{0}", p);
}
}
}