大家帮个忙 急急急、、、

Jyang0701 2009-12-06 06:00:20
我写了个方法: public static void AddScore(ref int score, out int result) {
if(score>50&&score<60){
Console.Write("你的成绩在50~60之间,可以加分");
score = 60;
}
result=score;

}
在调用时它报参数问题 我有点不会饿 新手呵呵、、、帮个忙

另外 我今天电脑触摸板下面的按键进去了点水, 我把电池下了 ,然后把按键那个位置吹了哈, 过了半个小时用起来没什么问题,我不晓得会不会还出什么问题。急急急啊、、、
...全文
62 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
烈火蜓蜻 2009-12-06
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 liherun 的回复:]
C# codepublicstaticvoid AddScore(refint score,outint result) {if(score>50&&score<60){
Console.Write("你的成绩在50~60之间,可以加分");
score=60;
}
result=score;

}
void的方法return int

[/Quote]

他的score参数是ref的,没有return;
woshifou 2009-12-06
  • 打赏
  • 举报
回复
调用时第一个参数要为引用类型的。
liherun 2009-12-06
  • 打赏
  • 举报
回复
大家都去押尤文图斯赢吧,比赛已经结束了,尤文2比1国米
diandian82 2009-12-06
  • 打赏
  • 举报
回复
你怎么调用的,调用的时候也要写ref out

int a,b;

AddScore(ref a, out b);
zhujiazhi 2009-12-06
  • 打赏
  • 举报
回复
报什么错误的呢?传入参数没有初始化?
liherun 2009-12-06
  • 打赏
  • 举报
回复
public static void AddScore(ref int score, out int result) { 
if(score>50&&score <60){
Console.Write("你的成绩在50~60之间,可以加分");
score = 60;
}
result=score;

}

void的方法return int
bancxc 2009-12-06
  • 打赏
  • 举报
回复
别急 看不出毛病

111,120

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧