I am trying to write a simple C++ slot machine program to run three number A , B and C. The problem is no are not generating number randomly.
Code:// slot machine #include<iostream> #include<cstdlib> #include<ctime> using namespace std; int main() { int number A = 0, number B = 0, number C = 0; srand (time(0)); int Y; for (Y = 0; Y < 3; Y++) { int random = rand(); int number = (random % 3) + 1; cout << number << " "; } return 0; }
Bookmarks