I am a beginner at c++ and i was trying to make this dice in a matrix that would show 1 exactly on the positions where a real dice has its dots and 0 in rest. Can someone help me by telling me why is it giving me this error when i run it. I would really appriciate it.
#include<iostream.h>
#include<stdlib.h>
#include<stdio.h>
int i,j,t,w,a[6][6];
struct zar
{
int x1,y1,x2,y2;
};
zar x,y,z,k;
int rand()
{
w=random(3)+1;
while (w>=1)
{
t=random(4)+1;
if (t==1)
{
a[x.x1][x.y1]=1;
a[x.x2][x.y2]=1;
}
else if (t==2 && a[1][1]==1)
{
a[y.x1][y.y1]=1;
a[y.x2][y.y2]=1;
}
else if (t==3 && a[1][1]==1 && a[3][1]==1)
{
a[z.x1][z.y1]=1;
a[z.x2][z.y2]=1;
}
else if (t==4 && a[2][1]==0)
a[k.x1][k.y1]=1;
w--;
}
return a[j];
}
void main ()
{
x.x1=1;
x.y1=1;
x.x2=3;
x.y2=3;
y.x1=1;
y.y1=3;
y.x2=3;
y.y2=1;
z.x1=2;
z.y1=1;
z.x2=2;
z.y2=3;
k.x1=2;
k.y1=2;
k.x2=0;
k.y2=0;
for (i=1;i<=3;i++)
for (j=1;j<=3;j++)
a[j]=0;
cout<<rand()<<" ";
cout<<endl;
}