我在尝试编译code :: blocks中的以下代码时出现此单列错误。
错误发生了8行。“错误:从'int'转换为非标量类型'COORD'请求”
#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;
}
非常感谢。 – 2011-04-07 03:20:52