![]() |
|
|
Регистрация Восстановить пароль |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
![]() |
|
Опции темы | Поиск в этой теме |
![]() |
#1 |
Форумчанин
Регистрация: 16.02.2013
Сообщений: 179
|
![]()
Создаю окно , заполняю его точками.У меня такой же текст как у автора,но у него окно просто заполняется точками,а у меня последняя строчка , то заполняется , то стирается.В чем дело?Программа написана на Visual Studio 2022.
#include <iostream> #include<windows.h> #include <cstdlib> #include <ctime> #include <cstdio> #include <cstring> using namespace std; const int fld_width = 20; const int fld_height = 30; const int scr_width = fld_width * 2; const int scr_height = fld_height; const char c_fig = 219; const char c_field = 176; const char c_figDwn = 178; typedef char TScreenMap[scr_height][scr_width]; typedef char TFieldMap[fld_height][fld_width]; const int shp_width = 4; const int shp_height = 4; typedef char TShape[shp_height][shp_width]; void SetCurPos(int x, int y) { COORD coord; coord.X = x; coord.Y = y; SetConsoleCursorPosition(GetStdHand le(STD_OUTPUT_HANDLE), coord); } class TScreen { void SetEnd() { scr[scr_height - 1][scr_width - 1] = '\0'; } public: TScreenMap scr; TScreen() { Clear(); } void Clear() { memset(scr, '.', sizeof(scr)); } void Show() { /*SetCursorPos(0, 0);*/ SetEnd(); cout << scr[0]; } }; class TGame { TScreen screen; public: void Show(); }; void TGame::Show() { screen.Clear(); screen.Show(); } int main() { char command[1000]; sprintf_s(command, "mode con cols=%d lines=%d", scr_width, scr_height); system(command); srand(time(0)); TGame game; while (1) { game.Show(); if (GetKeyState(VK_ESCAPE) < 0) break; Sleep(50); } return 0; } |
![]() |
![]() |
![]() |
![]() |
||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
[РЕШЕНО]: Смещение Div | antonb770 | HTML и CSS | 3 | 27.04.2015 09:54 |
Смещение блоков.... | Jen4ik | HTML и CSS | 2 | 25.03.2015 15:10 |
Смещение | pastuhdima | Помощь студентам | 0 | 19.11.2011 00:37 |
Смещение | Зод | Win Api | 1 | 26.08.2011 13:40 |
Смещение по psp | CodeNOT | Общие вопросы C/C++ | 2 | 09.03.2011 23:04 |