I'm trying to simulate the spin of a slot machines [reel1][reel2][reel3] so they look like they are in motion.
i'm getting this error:
Error 2 error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion)
//rotation of the reels
using namespace std;
int main()
{
//variables
string reelArray[7];
int reel1;
int reel2;
int reel3;
int spin = 0;
reelArray[0] = "[ LEMON ]";
reelArray[1] = "[ ORANGE ]";
reelArray[2] = "[ HEART ]";
reelArray[3] = "[ SMILEY ]";
reelArray[4] = "[ STAR ]";
reelArray[5] = "[ MOON ]";
reelArray[6] = "[ SEVEN ]";
srand(time(NULL));//seed RNG
for(int i = 0; i < 7; i++)
{
int max = 7;//initialize max
reel1 = 1 + rand()%(max - 1 + 1);//RNG 1 through 7
reel2 = 1 + rand()%(max - 1 + 1);//RNG 1 through 7
reel3 = 1 + rand()%(max - 1 + 1);//RNG 1 through 7
if(reelArray[i] == (reel1 - 1))
{
spin++;
cout<<reelArray[i]<<' '<<reelArray[i]<<' '<<reelArray[i]endl;
cout<<reel1<<endl;//testing output
cout<<reel2<<endl;//testing output
cout<<reel3<<endl;//testing output
switch(spin)
{
case 0:
Sleep(100);
break;
case 1:
Sleep(120);
break;
case 2:
Sleep(175);
break;
case 3:
Sleep(250);
break;
case 4:
Sleep(350);
break;
case 5:
Sleep(450);
default:
Sleep(1000);
}
}
}
return 0;
}
this program is a stub im working on to eventually add to my full program.
please let me know if im going with this is the wrong direction!