尝试在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)
COORD pos = (40, 3);
Run Code Online (Sandbox Code Playgroud)
这应该是:
COORD pos = {40, 3};
Run Code Online (Sandbox Code Playgroud)
注意使用{}而不是().
| 归档时间: |
|
| 查看次数: |
2022 次 |
| 最近记录: |