I got bored and just wanted to make a magic 8ball program in c++. It simple yet fun, but I noticed a problem.
#include <iostream>
#include <string>
using namespace std;
int main()
	string question;
	string yn;
	int srand(0);
	string again;
	char* answer[] =
	 "As I See It, Yes\n",
	 "Ask Again Later\n",
	 "Better Not Tell You Now\n",
	 "I don't Want to Tell You\n",
	 "Concentrate And Ask Again\n",
	 "Don't Count On It\n",
	 "It Is Certain\n",
	 "It is Decidedly So\n",
	 "Most Likely\n",
	 "My Reply Is No\n",
	 "My Sources Say No\n",
	 "Outlook Good\n",
	 "Outlook Not So Good\n",
	 "Reply Hazy, Try Again\n",
	 "Signs Point To Yes\n",
	 "Very Doubtful\n",
	 "Without A Doubt\n",
	 "Yes Definately\n",
	 "You May Rely On It\n"
//	for(int i=0;i<20;i++)
//	{cout << answer[i];}

 do {
  cout << "Ask Your Question: ";
  getline(cin, question);
  cout << "Your Question was:\n" << question <<endl;
  cout << "Are You Ready For My Answer?(y/n): ";
  cin >> yn;
  if (yn=="y")
	cout << answer[rand()%20]<< endl;

  cout << "Ask Again?(y/n): ";
  cin >> again;


return 0;

When I save and run this in Visual Studio, everything works fine and it randomly picks an answer. However when I compile and run this on my Slackware partition, it picks the same answer everytime.
Also when it executes through and asks if it should be run again, when I type in 'y' it skips the question input and goes to the "Are you ready to see my answer" part. I think it has something to do with getline()....I am not in any hurry to figure this out, more just to satisfy my curiosity, so any help would be appreciated.