printf:
Code: Select all
#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;
}
cout:
Code: Select all
#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