Wheel of fortune

Im making a wheel of fortune game in Dev C++ and I would just like to ask if its possible to create a simulation wheel that will get a random $, like litteraly a wheel, not just words. And if so, what library/function it needed to work. Thank you very much
Last edited on
What's a "random $" ?
@moschops - Wheel of fortune is a US TV game show where contestants spin a large wheel to select the value of guessing a letter.
https://en.wikipedia.org/wiki/Wheel_of_Fortune_(U.S._game_show)

@reiv63 - The easiest way to do this is to create an array of 24 values. One for each space on the wheel.
1
2
 
  int values[24] = { 900, 700, 600, // etc }; 

Then generate a random number between 0 and 23. The value of the spin is then selected from the array based on the random number.
1
2
3
4
  int amt, r;

  r = rand() % 24;
  amt = values[r];


You can use 0 if you want to represent the two bankrupt spaces.
Last edited on
http://www.cplusplus.com/faq/beginners/random-numbers/
Unfortunately, I haven't gotten to writing part two yet, which deals with CSPRNGs -- the kind of PRNG you want for Monte Carlo simulations...

C++ does provide a potentially-useful access point via the std::random_device class in <random>. Otherwise you'll have to look into some platform-specific TRNG/CSPRNG sources. (OpenSSL libraries provide an easy one.)
thank you sir, it helps me a lot, just one last question, how can you compile application of a multiple .cpp's, i saw it on tutorials, but can't somewhat connect it together. The codes for wheel of fortune got so many lines and got so confusing when editing it, so i thought i should separate functions by functions, but by no avail i cannot.

I'm trying to figure out how to do something like this for my wheel of fortune:
https://www.dropbox.com/sh/sbk8xsd532pvr2r/-DcJSPXljO
Last edited on
If you are using an IDE, you need only create a new "project" and add each .cpp file to the current project.

If you are using the command line, just list all the .cpp files:

    g++ -Wall -std=c++14 -pedantic -O2 foo.cpp bar.cpp baz.cpp

Hope this helps.
thank you good sir!
Topic archived. No new replies allowed.