就这么一个小例子,大家帮帮忙using System;namespace delme
{
public class Pdtype
{
public float x;
public Pdtype next;
}; class Class1
{
float find_x(Pdtype pd, int num)
{
Pdtype pdtemp;
int i;
pdtemp=pd;
for (i=1; i<num; i++)
pdtemp=pdtemp.next;
return (pdtemp.x);
} static void Main(string[] args)
{
Pdtype pdh;
float f=find_x(pdh, 5);
Console.Write(f);
}
}
}
{
public class Pdtype
{
public float x;
public Pdtype next;
}; class Class1
{
float find_x(Pdtype pd, int num)
{
Pdtype pdtemp;
int i;
pdtemp=pd;
for (i=1; i<num; i++)
pdtemp=pdtemp.next;
return (pdtemp.x);
} static void Main(string[] args)
{
Pdtype pdh;
float f=find_x(pdh, 5);
Console.Write(f);
}
}
}
解决方案 »
- 国庆提问,求大虾帮忙!如何在Form A中设置Form B中button的visible属性?
- 数组遍历取下标
- 有人用过Xenocode Postbuild脱离.net框架的吗
- WebForm有没有象WinForm里类似的DateTimePicker控件
- ListView控件问题(在线等)
- 50分求教,我不是学C的,只是想了解一下!
- 关于C#读取Excel的单元格高度
- 模拟post提交的一点问题
- 如何在Web Browser控件中显示一个字符串中的内容?
- C#PropertyGrid动态设置属性Browsable为false,所有的属性不见了
- 请教c# 怎样读写INI文件?
- ■■■关于DataGrid的一个前卫难题~~~■■■
using System;namespace ConsoleApplication2
{
public class Pdtype
{
public float x;
public Pdtype next;
}; class Class1
{
static float find_x(Pdtype pd, int num) //更改
{
Pdtype pdtemp;
int i;
pdtemp=pd;
for (i=1; i<num; i++)
pdtemp=pdtemp.next;
return (pdtemp.x);
} static void Main(string[] args)
{
Pdtype pdh = new Pdtype (); //更改
pdh.x = 1; //更改
pdh.next = pdh ; //更改
float f=find_x(pdh, 5);
Console.Write(f);
}
}
}
解决方法是把函数写成STATIC float find_x(Pdtype pd, int num)