The program listed below lets a user input a state, and the program tells the user if that is the state that the program randomly picked (from the enumeration block)...but I'm having a hard time getting to work. Any ideas?
Code:#include <iostream> #include <string> #include <stdlib.h> #include <time.h> using namespace std; enum block {ohio, texas, maine}; void guess(string& input, int& computer_number); block states; int main() { srand(time(0)); int computer_number = rand()%3; static_cast<block>(computer_number); string input; cout << "Enter the state: "; cin >> input; guess(input, computer_number); return 0; } void guess(string& input, int& computer_number) { if (input == computer_number) { cout << "You guessed the state!"; } else { cout << "You did not."; } }