Trying to do some basic "Game of life", but for some reason i'm getting some weird results, the code:

```
#include "stdafx.h"
#include "stdlib.h"
#include <iostream>
using namespace std;
#include "windows.h"
const int V=30;//Vertical
const int H=40;//Horizontal
char A[V][H];
int ne=0;
//Set all to dead
void setDead()
{
for (int i=0;i<V;++i)
{
for (int j=0;j<H;++j)
{
A[i][j]='-';
}
}
}
//Print
void print()
{
system("cls");
for (int i=0;i<V;++i)
{
for (int j=0;j<H;++j)
{
cout<< A[i][j];
}
cout<< endl;
}
}
//Enter alive cells
void enter()
{
int h=0,v=0;
bool status=false;
while(true)
{
cout<< "Enter Vertical: ";
cin>> v;
cout<< "Enter Horizontal: ";
cin>> h;
if ( (h==-1)||(v==-1) )
{
break;
}
A[v][h]= '*';
print();
}
}
//Compute
void compute()
{
for (int i=0;i<V;i++)
{
for (int j=0;j<H;j++)
{
ne=0;
if ( A[i][j-1]=='*' ) { ne+= 1; }
if ( A[i-1][j-1]=='*' ) { ne+= 1; }
if ( A[i-1][j]=='*' ) { ne+= 1; }
if ( A[i-1][j+1]=='*' ) { ne+= 1; }
if ( A[i][j+1]=='*' ) { ne+= 1; }
if ( A[i+1][j+1]=='*' ) { ne+= 1; }
if ( A[i+1][j]=='*' ) { ne+= 1; }
if ( A[i+1][j-1]=='*' ) { ne+= 1; }
if ( A[i][j]=='*' && ne<2 ) { A[i][j]='-'; }
else
if ( A[i][j]=='*' && ne>3 ) { A[i][j]='-'; }
else
if ( A[i][j]=='*' && (ne==2||ne==3)) { A[i][j]='*'; }
else
if ( A[i][j]=='-' && ne==3 ) { A[i][j]='*'; }
}
}
}
int main()
{
setDead();
print();
enter();
while(true)
{
print();
compute();
Sleep(1000);
}
char f;cin>>f;
return 0;
}
```