So what exactly does it do? Print "Merry Christmas" and "Happy New Year" in such a way them move over the screen? Could you show some example output? That way it would be easier to help understand your problem.
The have a loop which does the following over and over
print the string followed by carriage return '\r';
remove the first character from the string. Add it to the end of the string.
delay for a few tens or hundreds of milliseconds
There is no code. I just gave some suggestions for you to try. Maybe you should have a go and then ask questions when you get stuck. Post the code you have written so far,
Example code of @Chervil's implementation could be something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
int main()
{
int spaces = 0; //Used to store the number of spaces to print
while(true) //Keep on going forever
{
std::cout << "\r"; //Go back to the beginning of the lien
for(int i = 0; i < spaces; ++i)
std::cout << " "; //Print the spaces
std::cout << "Merry Christmas"; //Print the message
sleep(1000); //Wait for a second
++spaces; //Increase the number of spaces to draw
}
return 0;
}
Given your terminal interprets a carriage return as a "go to the beginning of the line" command (this might not always be the case, take old Mac computers for example), this would write "Merry Christmas" that moves left every iteration. The function sleep is platform dependent, this could be Sleep on windows or sleep on Unix.