#include <iostream.h>
#include <stdlib.h>
#include <time.h>
#include <iomanip.h>
#include <windows.h>


main()
{
	srand(time(0));
	float p=18/37;
	int result = 0;
	float even=0, odd=0, zero=0; 
	int thing=0;
	float bet=5, total=100, profit=0, start=50;
	float total_profit;
	float mean_profit;
	char win;
	int i=0;
	int num=10;
	int times=2;
	int eye=0;
	float profitper=0;
	float pp=0;
	bool go=true, z=true;

	for(int a=0;a<times;a++)
	{
	bet=2;
	total=start;
	even=0;
	odd=0;
	zero=0;
	thing=0;
	int i=0;
	
	do
	{
	do
	{
		if((total-bet)<1)
		bet--;
	} while((total-bet)<1);

	z=((total-bet)>10)&&profit<100;
	go = ((total-bet)>1)&&z;
	if ((profit>start)&&((profit-bet)<0))
	{	go=false;}
	if (go)
	{

	total=total-bet;	
	result=rand()%37;
	thing=result%2;
	
	
	if(result==0)
	{zero++;
	win='L';}
	else
	{if(thing==0)
		{
			total+=2*bet;
			even++;
			win='W';

		}
		else
		{
			odd++;
		win='L';
		}
	}
	profit = total-start;
cout << win<< ", Bet: "<<bet<<"     Money: "<<total<<"     Profit: "<<profit<<endl;

	bet=bet*2;
//	do
//	{
//	bet++;
//	}while(bet<(total/10));
	
	
	i++;
	}
	}while(go);

	if (profit>0)
	{
		profitper++;
	}
	eye+=i;
	total_profit=total_profit+profit;
	cout << setprecision(5)<<"\nEven: "<<even<<", "<<(even/i)*100<<"%";
	cout << "\nOdd:  "<<odd<<", "<<(odd/i)*100<<"%";
	cout << "\nZero: "<<zero<<",  "<<(zero/i)*100<<"%"<<endl<<endl;
	}
	
	mean_profit = total_profit / (times+1);
	pp=(profitper/times)*100;
	cout << "Profit Percentage: "<<pp<<"%\n";
	cout << "\n\nMean Profit: "<<mean_profit<<"\n";
	cout << "\n\nMean N: "<<eye/times<<"\n";	
	return 0;
}
