求会c#的朋友!
来源:百度知道 编辑:UC知道 时间:2024/05/27 15:25:48
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace DeviceApplication7
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (score > 100)
Console.WriteLine("主人: 猫叫了!");
else
Console.WriteLine("主人: 猫虽然叫了, 声音不够大, 主人没听见!");
}
}
}
这段代码。想起一个变量int score在什么地方写呢?
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace DeviceApplication7
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (score > 100)
Console.WriteLine("主人: 猫叫了!");
else
Console.WriteLine("主人: 猫虽然叫了, 声音不够大, 主人没听见!");
}
}
}
这段代码。想起一个变量int score在什么地方写呢?
你那个score,来历不明·····你不给出一个他获得取值的途径,我们怎么好改啊
private void button1_Click(object sender, EventArgs e)
{
int score;
if (score > 100)
Console.WriteLine("主人: 猫叫了!");
else
Console.WriteLine("主人: 猫虽然叫了, 声音不够大, 主人没听见!");
}
我觉得这个值应该是在运行的时候输入的 这样程序才可以灵,你可以再加一个textbox标签,把他的。Text的值赋给score
既然有button1_Click那么就是WinForm程序了.
用Console.WriteLine做输出???那是控制台程序的输出啊.