C
C#2mo ago
~Nost~

✅ New to C# and need help! Guess the number game.

Hi everyone I need some help I started to learn c# about a month ago and I need to make a little game but i dont know how. All I know is that i have to use "Random willekeurig = new Random(1-1000); " for a random number between 1 and 1000 AND I need to use if {}MessageBox.show "The number is higher/lower" else {} Congarts u did it!!!!. Can anyone help me with a code please ;(. -VisualStudio -WindowsFormsApp
10 Replies
Jimmacle
Jimmacle2mo ago
Random willekeurig = new Random(1-1000); this is not correct where exactly are you getting stuck? do you have errors?
~Nost~
~Nost~OP2mo ago
I dont really have anything yet. i have a form with 1 button and 1 TextBox and if you type in a number It says higher/lower. And the number needs to be random number from 1 to 1000 idk how anything works with the random number thing so i just wanted to ask some help with it before i start you know If not then how does it work?
Jimmacle
Jimmacle2mo ago
the Random constructor takes a value to use as an initial seed what you wrote creates a Random instance with a seed of -999 which means that every time you run the program it will generate the same random numbers
~Nost~
~Nost~OP2mo ago
Soooo
~Nost~
~Nost~OP2mo ago
Tried to use this but doesn't really work with my if else with messageboxes
Jimmacle
Jimmacle2mo ago
you'll have to be more specific about how it "doesn't really work"
Pobiega
Pobiega2mo ago
share your code that doesn't work, specifically where you generate the random number and where you call the messagebox
mtreit
mtreit2mo ago
$code
MODiX
MODiX2mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
Want results from more Discord servers?
Add your server