#include <iostream>
#include <ctime>
using namespace std;
int main() {
srand(time(0));
int randNum = (rand() % 5 + 1 );
switch(randNum){
case 1:
cout << "You win a gummy bear\\n";
break;
case 2:
cout << "You win an Apple Watch\\n";
break;
case 3:
cout << "You win an iPhone\\n";
break;
case 4:
cout << "You win a mouse\\n";
break;
case 5:
cout << "You win an AirPods\\n";
break;
}
}
In this code, I used the rand function in C++ to randomize every case in the switch functions.