Mam problem z programem. Po uruchomieniu F9 pojawia się pusta konsola, a na dole komunikat taki jak w temacie. Oto kod:
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <conio.h>
using namespace std;
int main()
{
srand( time( NULL ) );
int s [9] [4];
int limit [4] = {};
int x [4] = {};
for(int i=0; i<=8; i++)
{
for(int j=0; j<=3; j++)
{
s [i] [j] = rand() % 4 + 1;
if (s [i] [j] == 1)
{
if (limit [s [i] [j]-1] <= 8)
limit [s [i] [j]-1] = limit [s [i] [j]-1] + 1;
else
{
if (j==0)
{
j=3;
i=i-1;
}
else
j = j-1;
}
}
if (s [i] [j] == 2)
{
if (limit [s [i] [j]-1] <= 8)
limit [s [i] [j]-1] = limit [s [i] [j]-1] + 1;
else
{
if (j==0)
{
j=3;
i=i-1;
}
else
j = j-1;
}
}
if (s [i] [j] == 3)
{
if (limit [s [i] [j]-1] <= 8)
limit [s [i] [j]-1] = limit [s [i] [j]-1] + 1;
else
{
if (j==0)
{
j=3;
i=i-1;
}
else
j = j-1;
}
}
if (s [i] [j] == 4)
{
if (limit [s [i] [j]-1] <= 8)
limit [s [i] [j]-1] = limit [s [i] [j]-1] + 1;
else
{
if (j==0)
{
j=3;
i=i-1;
}
else
j = j-1;
}
}
}
}
for(int i=0; i<=8; i++)
{
for(int j=0; j<=3; j++)
{
cout << s [i] [j];
if (s [i] [j] == 1)
x [0] = x [0] + 1;
if (s [i] [j] == 2)
x [1] = x [1] + 1;
if (s [i] [j] == 3)
x [2] = x [2] + 1;
if (s [i] [j] == 4)
x [3] = x [3] + 1;
}
}
cout << endl << x[1] << endl << x[2] << endl << x[3] << endl << x[0];
return 0;
}