Cin is ambiguous

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <ctime>
#include <string>

using namespace std;


int main()
{

	int random;
	int ans;
	int turn;
	const int sheep = 5;
	string color[sheep] = {"Brown", "White", "Green", "Yellow", "Blue"};

	cout<<"Press 1 to start"<<endl;
	cin >> ans;

	do{
		srand (time(0));
		random = (rand()%5) + 1;

	}while (ans == 1);

	






	}

	






	cin.get();
	cin.get();
	return 0;
}


This is only the first part of the code, so i have unfinished functions and Ive included lots of libraries I dont need. But My compiler says cin is ambiguous and return expected a function. No idea why it isnt working. Any help pleasee?
what's with the cin.get()'s? remove them and try again.
int main()
{

int random;
int ans;
int turn;
const int sheep = 5;
string color[sheep] = {"Brown", "White", "Green", "Yellow", "Blue"};

cout<<"Press 1 to start"<<endl;
cin >> ans;

do{
srand (time(0));
random = (rand()%5) + 1;
printf(" \n\ninside the fnc - ans = %d ", ans );
cin >> ans;


}while (ans == 1);


It's hung in the loop. Once you give it '1' then it stays 1 forever.
so I added these two lines ( only the " cin >> ans; " is required )
so that when finished, it asks for a new value, like NOT 1.

Printf statements ( and other similar flags) are Always useful to tell where I am and what the values being returned are the values expected.

Topic archived. No new replies allowed.