TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
zero cool
NA
9
7.2k
Need help with C# program
Sep 7 2012 12:30 PM
Forms based game, you will have:
- A 4x4 array of square buttons. You will name each of these buttons differently, from Button_0_0 to Button_3_3
-A button which reads "New game"
-A non-editable text box where you will display feedback for the user
When the new game button is pressed:
- you will randomly choose the X coordinate [0-3] and Y coordinate [0-3] of the button that contains the "treasure". You will save these randomly chosen X and Y coordinates in the two int data members named treasureX and treasureY of the form (you have to add these two data members outside the callback but inside the form class code.
When the user presses one of the 16 buttons, you will:
-Check to see if the X and Y coordinate of the button matches the treasureX and treasureY coordinate. if so,
- You will report to the user "You found the treasure!", otherwise
-You will report to the user "Sorry there is no treasure here!"
This will require you to define 16 callback functions, one for each button
To get a random integer consider the following code
Random r = new Random();
int x = r.Next (100, 200);
which will set x between 100 and 199 inclusive (it will never return 200)
Reply
Answers (
7
)
C# Send Email with attach file
any body having IABC source code ..