Noob programmer here, trying to get some help on a assignment. I will use a similar example, if someone can help me figure out what I am doing wrong that would be great. I am aware rand is a integer and it cannot be set equal to enum by default. I am trying to get rand integer to pair a randomly selected enum. Sorry for reposting a question already asked, but other examples written by other users kinda confuse me.
NOTE: I did not add srand to seed random number because in my specific assignment, it does not need to be seeded according to my instructor, not sure why but just following instructions.
#include <iostream>
#include <ctime>
#include <iomanip>
using namespace std;
int main(){
enum SHIRT_COLOR { WHITE, BLACK, RED, GREEN};
int value = 0; //rand num to be generated
value = rand() % 4;
SHIRT_COLOR shirt = WHITE;
SHIRT_COLOR shirt = BLACK;
SHIRT_COLOR shirt = RED;
SHIRT_COLOR shirt = GREEN;
shirt = static_cast<SHIRT_COLOR>(value);
cout << "Random Shirt Color: " << shirt;
}