Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. #include <cstring>
  5.  
  6. class Monte {
  7.  
  8.    
  9.  
  10. public:
  11.  
  12.    void shuffle(char** Doors, int n) {
  13.  
  14.         char** tempDoor;
  15.         srand(time(NULL));
  16.         for (int i = n - 1; i > 0; i--) {
  17.             int j = rand() % (i + 1);
  18.             tempDoor[i] = Doors[i];
  19.             Doors[i] = Doors[j];
  20.             Doors[j] = tempDoor[i];
  21.         }
  22.    };
  23.    
  24.     void printDoors(char** Doors) {
  25.         std::cout << Doors[0] << " " << Doors[1] << " " << Doors[2];};
  26.  
  27.     };
  28.  
  29.  
  30. int main() {
  31.     Monte test;
  32.     char** Doors;
  33.     strcpy(Doors[0], "Car");
  34.     strcpy(Doors[1], "Goat");
  35.     strcpy(Doors[2], "Goat");
  36.     test.printDoors(Doors);
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement