Hi guys im trying to make a program that will work as " Slot Machine " and im stuck in one part that i can not resolve. Im trying to verify predetermined char in random array so i can know if some of char appear three times or more. I want to do that so i can deteremined how much player is going to win. It depends on how many lines of the same char do player get. Im new to programming so i would appreciate any help that i can get. Here my code that i need help with.

#include <iostream>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;



 


int main ()
{
    cout << endl ;
    cout << "                Welcome to money making '' SLOT MACHINE '' game " << endl;
    cout << endl;
    
    int age;
    cout << " Please verify your age: ";
    cin >> age;
    cout << endl;
    
    if (age>17) 
    {
               cout << "You are eligible to play" << endl;
               }
    else {
               cout << "You are not eligible to play" << endl;
         
               system("PAUSE");
               return 0;
         }
    cout << endl ;
    
    int account; 
    cout << "How much money would you like to withdraw from your account: " << endl;
    cout << endl;
    cin >> account;
    cout << endl;
    
    cout << account << " has been withdrawed from your account" << endl; 
    cout << endl;
    
     bool running=true; 
    
    while (running == true) 
    {
    int bet=50||100||200; 
    
    cout << "Now you are welcome to set your bet" << endl;
    cout << endl;
    
    cout << "You can bet a 50,100 or 200 " << endl;
    cout << endl;
    
    cout << "Choose how much you would like to bet: 50, 100 or 200" << endl;
    cout << endl;
    
    cin >> bet; 
    cout << endl;
    
    if (bet == 50) 
    {
             cout << "You have bet 50" << endl;
             }
    else if(bet == 100)
    {
         cout << "You have bet 100" << endl;
         }
    else if(bet == 200)
    {
         cout << "You have bet 200" << endl;
         }
    
    cout << endl;
    account-=bet; 
    cout << "You have " << account << " left to play for" << endl;  
    
    srand ( time(0));

    char sign[3]; 
    sign [0] = '$';
    sign [1] = 'X';
    sign [2] = 'O';
    
    for (char i = 0; i < 3; ++i) 
    { 
        char r  = rand() % 3;
        char s  = rand() % 3;
        char d  = rand() % 3;
        
        cout << "___ ___ ___\n";
        cout << " "<<sign[r]<< " | " << sign[s] << " | " << sign[d] << " | " << "\n"; 
        cout << "___|___|___|\n";
        
       
        
       
        
        }
        
        
        
        
        
        
        
        
    system("PAUSE");

}
}

I'm not sure I understand your question. Are you asking the probability of certain patterns of characters occurring? Or, are you asking how to compare the selected characters?

Yeah im asking how to compare selected characters

if (r == s && s == d) {
//winner!
}

You may want to put in another test to see if r == '$' (I assume that's what you want to pay on).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.