Generated arrays, each containing 100 numbers.
i am having a problem with this as it is saying expected class delegate enum interface or struct for void has anyone got an idea what is wrong here if so help is great thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Santhosh NRank #4,788 · 325 reputationPosted Dec 13, 2010, 4:30 PM EST
Suthish NairRank #92 · 22.8K reputationPosted Dec 13, 2010, 6:24 PM EST
We can only guess about your problem unless you need to provide full description or details about your post.
CrishRank #1,487 · 1.1K reputationPosted Dec 14, 2010, 12:13 AM EST
You can refer this below code to solve your issue.
Example:
namespace PickLarger
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
class click
{
public static int buttonclick = 0;
}
public int totalClicks()
{
int total=0;
for(total = 0; total <= 100; total++)
{
total++;
MessageBox.Show("" + total);
}
return total;
}
public int getRandomNumberbtn1()
{
// Finds random number between 1 and 100
Random number = new Random();
int randomNumberbtn1 = number.Next(0, 100);
return randomNumberbtn1;
}
public int getRandomNumberbtn2()
{
// Finds random number between 1 and 100
Random number = new Random();
int randomNumberbtn2 = number.Next(0, 100);
return randomNumberbtn2;
}
private void btn1_Click(object sender, EventArgs e)
{
click.buttonclick++;// Counting button clicks
int r1 = getRandomNumberbtn1();
MessageBox.Show("Your chose Button One which equals : " + getRandomNumberbtn1());
int r2 = getRandomNumberbtn2();
MessageBox.Show("Button Two's random Number is : " + getRandomNumberbtn2());
int highNo;
if (r1 > r2)
{
highNo = r1;
MessageBox.Show("You Win : " + highNo);
}
else
{
highNo = r2;
MessageBox.Show("You Lose");
}
MessageBox.Show("You have clicked a button: " + click.buttonclick + " Times");//Displaying button click count
}
private void btn2_Click(object sender, EventArgs e)
{
click.buttonclick++;// Counting button clicks
int r1 = getRandomNumberbtn1();
MessageBox.Show("Button One's random Number is : " + getRandomNumberbtn1());
int r2 = getRandomNumberbtn2();
MessageBox.Show("Your chose Button Two which equals : " + getRandomNumberbtn2());
int highNo;
if (r2 > r1)
{
highNo = r2;
MessageBox.Show("You Win : " + highNo);
}
else
{
highNo = r1;
MessageBox.Show("You Lose");
}
MessageBox.Show("You have clicked a button: " + click.buttonclick + " Times");//Displaying button click count
}
public void close()
{
int i = click.buttonclick;
for (i=0;i>3;i++)
{
Application.Exit(); // trying to close the form after button clicks equal more than 3
}
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
gemma browse10 reputationPosted Dec 14, 2010, 2:15 AM EST