printf:
Код: Выделить всё
#include
#include
int main() {
int i;
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO screen;
GetConsoleScreenBufferInfo(console, &screen);
short columns = screen.srWindow.Right - screen.srWindow.Left + 1;
short rows = screen.srWindow.Bottom - screen.srWindow.Top + 1;
char characters[columns * rows + 1];
for (i = 0; i < columns * rows; i++) {
characters[i] = '.';
}
characters[columns * rows] = '\0';
for (i = 0; i < 5000; i++) {
printf(characters);
SetConsoleCursorPosition(console, (COORD){0, 0});
}
return 0;
}
печать:
Код: Выделить всё
#include
#include
#include
int main() {
int i;
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO screen;
GetConsoleScreenBufferInfo(console, &screen);
short columns = screen.srWindow.Right - screen.srWindow.Left + 1;
short rows = screen.srWindow.Bottom - screen.srWindow.Top + 1;
char characters[columns * rows + 1];
for (i = 0; i < columns * rows; i++) {
characters[i] = '.';
}
characters[columns * rows] = '\0';
for (i = 0; i < 5000; i++) {
std::print("{}", std::string(characters));
SetConsoleCursorPosition(console, (COORD){0, 0});
}
return 0;
}
cout:
Код: Выделить всё
#include
#include
int main() {
int i;
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO screen;
GetConsoleScreenBufferInfo(console, &screen);
short columns = screen.srWindow.Right - screen.srWindow.Left + 1;
short rows = screen.srWindow.Bottom - screen.srWindow.Top + 1;
char characters[columns * rows + 1];
for (i = 0; i < columns * rows; i++) {
characters[i] = '.';
}
characters[columns * rows] = '\0';
for (i = 0; i < 5000; i++) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79366555/what-is-the-fastest-function-to-print-text-into-the-terminal-in-c[/url]
Мобильная версия