PHP Code:
#include <conio.h>
#include <iostream>
using namespace std;
#define MAX_SCROLLTEXT 100
//
// general way to do it:
//
// get the text ("Test")
// copy it two times ("TestTest")
// REPEAT
// print the textlength ( Test = 4 ) characters of the two texts
// add one to start
// if start > textlength, set start back to zero
// UNTIL keypress
//
// note: gotoxy, _kbhit and a delay function are operating system specific.
int main()
{
char szScrollText[ MAX_SCROLLTEXT + 1 ];
char szScrolling[ MAX_SCROLLTEXT * 2 + 1 ];
int nTextLength;
int i = 0;
cout << "Enter Text to scroll:";
cin.getline( szScrollText, MAX_SCROLLTEXT );
strcpy( szScrolling, szScrollText );
strcat( szScrolling, szScrollText );
nTextLength = strlen( szScrollText );
memset( szScrollText, 0, MAX_SCROLLTEXT + 1 );
while( ! _kbhit() )
{
strncpy( szScrollText, szScrolling + i, nTextLength );
cout << szScrollText << endl;
i++;
if( i >= nTextLength ) i = 0;
// place gotoxy here
// place delay here
}
return 0;
}