1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#include <iostream>
#include <string>
#include <thread>
#include <chrono>
#include <algorithm>
#include <cstdlib>
#include <windows.h>
using namespace std;
HANDLE h = GetStdHandle( STD_OUTPUT_HANDLE );
//======================================
void gotoxy( int x, int y )
{
COORD c = { x, y };
SetConsoleCursorPosition( h, c );
}
//======================================
void delay( unsigned int msecs )
{
this_thread::sleep_for( chrono::milliseconds( msecs ) );
}
//======================================
void writeHorizontal( int x0, int y0, string s )
{
gotoxy( x0, y0 );
cout << s;
}
//======================================
void writeVertical( int x0, int y0, string s )
{
for ( char c : s )
{
gotoxy( x0, y0++ );
cout << c;
}
}
//======================================
int main()
{
string headline = " And on the sixth day God created Manchester ";
system( "cls" );
while( true )
{
writeHorizontal( 10, 0, headline );
writeVertical( 0, 0, headline );
rotate( headline.begin(), headline.begin() + 1, headline.end() );
delay( 300 );
}
}
| |