I don't understand why my code crashes when the variable "dicerolls" exceeds 15
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <iomanip>
using namespace std;
int main()
{
string a_or_b;
string aorbreverse;
unsigned short int dicerolls;
string y_or_n;
double ab = 0.5;
double aa = 0.5;
double ba = (double)2 / 3;
double bb = (double)1 / 3;
double ans = 0;
string letters = "";
restart:
cout << "Tring School Set 1 Maths H/W Quick Solver (by Kelechi)\n\nPress Enter";
cin.get();
system("cls");
cout << "Are we starting at A or B ?\n\nType A or B below\n\n";
cin >> a_or_b;
system("cls");
cout << "Okay so how many dice rolls ? (Between 1 and 65535)\n\n";
cin >> dicerolls;
system("cls");
cout << "So to recap we're\n\nStarting at " << a_or_b
<< "\n\nAnd we're doing\n\n" << dicerolls
<< " Dice Rolls\n\nType Y to continue, X to exit, or N to start again\n\n";
cin >> y_or_n;
if (y_or_n == "n" || y_or_n == "N")
goto restart;
else if (y_or_n == "x" || y_or_n == "X")
return 0;
int possible = 2;
letters = a_or_b;
unsigned long long int table [dicerolls];
for (int n = dicerolls; n>0; n--)
{
table [dicerolls - n] = possible;
possible = possible * 2;
}
string letterlist [table[dicerolls - 1]][dicerolls];
unsigned long long int totalruns = 0;
for (int n = dicerolls; n>0; n--)
{
totalruns = totalruns + table [dicerolls - 1];
}
unsigned int long long runs = 0;
unsigned int long long yrownumber = 0;
unsigned int long long xrownumber = 0;
cout << letterlist [3][0];
if (a_or_b == "a" || "A")
{
aorbreverse = "B";
}
else
{
aorbreverse = "A";
}
int x = table[0];
int y = 0;
int loops = 0;
unsigned int runs2;
for (int n = totalruns; n>0; n--)
{
if (runs == table[dicerolls-1])
{
yrownumber = 0;
xrownumber++;
y++;
x = table[y];
runs=0;
}
if (runs2 >= table[dicerolls-1]/(x/2))
{
runs2 = 0;
}
if (runs2 < table[dicerolls -1]/x)
{
letterlist [yrownumber][xrownumber] = a_or_b;
yrownumber++;
}
if (runs2 >= table[dicerolls -1]/x && runs < table[dicerolls -1])
{
letterlist [yrownumber][xrownumber] = aorbreverse;
yrownumber++;
}
runs++;
runs2++;
};
for(int n=0;n<table[dicerolls-1];n++)
{
for (int i = 0;i<dicerolls;i++)
{
cout << letterlist [n][i];
}
cout << "\n";
}
cin.get();
cin.get();
}