会C++的解决一下基本问题,运行出问题具体见文章

为什么我C++运行不了,程序应该是没错的,半成品,做的是一个类似2048的小游戏,我的电脑问题还是什么问题,代码我挂在下面

#include<iostream> 
#include<ctime>
#include<windows.h>
#include<cstdlib>
#include<conio.h> 
using namespace std;

int score=0;           //总分 
int map[4][4]={0} ;  //

int g=1;         //
int move=0;

//函数声明 
void hide();    //隐藏光标 
void gotoxy(short x, short y);  //定位
void start();  //输出背景
void print();    //输出数字和分数 
void newNum();
void top();
void down();
void left();
void right();
void changeMap();
void gameOver();

void hide()    //隐藏光标 
{
    HANDLE hl = GetStdHandle(STD_OUTPUT_HANDLE);  //句柄 
    CONSOLE_CURSOR_INFO  inf;
    GetConsoleCursorInfo(hl, &inf);
    inf.bVisible = false; 
    SetConsoleCursorInfo(hl, &inf);
}

void gotoxy(short x, short y)  //定位
{
    COORD position = { x, y };
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOut, position);   //设置控制台光标位置 
}

void start()  //输出背景 
{
    gotoxy(20,3);
    cout << "score:"  << score;
    for(int k=1;k<=7;k+=2)
        for(int l=0;l<=16;l+=4)
        {
            gotoxy(l,k);
            cout << "|" ;
        }
    for(int i=0;i<9;i+=2)
    {
        gotoxy(0,i);
        cout << "+---+---+---+---+" ;
    } 
}

void print()    //输出数字和分数 
{
    system("cls");
    start();
    for(int i=0;i<4;i++)
      for(int j=0;j<4;j++)
      {
          gotoxy(i*4+2,j*2+1); 
          if(map[i][j]!=0)
              cout << map[i][j];
      }
    gotoxy(20,3);
    cout << "score:"  << score;
}

void newNum()
{
    Sleep(500);
    move=0;
    int f=1;
    while(f)
    {
        int h=1;
        srand((int)time(0));
        int x=rand()%4;
        int y=rand()%4;
        int y2=y;
        if(map[x][y]!=0)
        {
            while(h)
            {
                x+=1;
                y=y2;
                if(x==4)
                    x=0;
                for(int i=0;i<4;i++) 
                {
                    if(map[x][y] == 0)
                    {
                        h = 0;
                        break;
                    }
                    else
                    {
                        y+=1;
                        if(y=4)
                           y=0;
                    }
                }
           }
        }
        map[x][y]=2;
        f=0;
        gotoxy(4*x+2,2*y+1);
        cout << 2;

没有main函数,添加


int main() {
  // 这里调用逻辑代码
  return 0;
}