8 Ball Code code is not randomizing

I was practicing with it on Visual Studios and even with srand(time(NULL)); present only once it will always choose choice 0 rather than doing different choices… What do I need to fix?

// Magic 8 Ball.cpp : This file contains the ‘main’ function. Program execution begins and ends there.


int main() {

std::cout << "MAGIC 8-BALL: \n\n";
int choice = std::rand() % 100;

std::cout << "What is your question?\n";
std::cin >> choice;

switch (choice) {

case 0: std::cout << "It is certain.\n"; break;
case 1: std::cout << "It is decidely so.\n"; break;
case 2: std::cout << "Without a doubt.\n"; break;
case 3: std::cout << "Yes - definitely.\n"; break;
case 4: std::cout << "You may rely on it.\n"; break;
case 5: std::cout << "As I see it, yes.\n"; break;
case 6: std::cout << "Most likely.\n"; break;
case 7: std::cout << "Outlook good.\n"; break;
case 8: std::cout << "Yes.\n"; break;
case 9: std::cout << "Signs point to yes.\n"; break;
case 10: std::cout << "Reply hazy, try again."; break;
case 11: std::cout << "Ask again later.\n"; break;
case 12: std::cout << "Better not tell you later.\n"; break;
case 13: std::cout << "Cannot predict now.\n"; break;
case 14: std::cout << "Concentrate and ask again.\n"; break;
case 15: std::cout << "Don't count on it.\n"; break;
case 16: std::cout << "My reply is no.\n"; break;
case 17: std::cout << "My sources say no.\n"; break;
case 18: std::cout << "Outlook not so good.\n"; break;
case 19: std::cout << "Very doubtful.\n"; break;



Notice how you’re reassigning the user’s input to the choice variable? That means that when the program reaches your switch statement, the variable choice isn’t a random number anymore; it’s the user’s question: