"错误:从'int'转换为非标量类型'COORD'请求"

Jus*_*ker 0 c++

尝试在code :: blocks中编译以下代码时,我遇到了这个单独的错误.
错误发生了8行.

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

int main()
{
HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos = (40, 3);
SetConsoleCursorPosition(screen, pos);
cout << "O" << endl;
Sleep(500);

for (int tossIt = 1; tossIt <= 3; tossIt++)
{
    while (pos.Y <= 20)
    {
        SetConsoleCursorPosition(screen, pos);
        cout << "|" << endl;
        pos.Y++;
        SetConsoleCursorPosition(screen, pos);
        cout << "O" << endl;
        Sleep(100);
    }
    while (pos.Y > 3)
    {
        SetConsoleCursorPosition(screen, pos);
        cout << " " << endl;
        pos.Y--;
        SetConsoleCursorPosition(screen, pos);
        cout << "O" << endl;
        Sleep(100);
    }
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)

Mat*_*gro 5

COORD pos = (40, 3);
Run Code Online (Sandbox Code Playgroud)

这应该是:

COORD pos = {40, 3};
Run Code Online (Sandbox Code Playgroud)

注意使用{}而不是().