#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <dos.h>
void main()
{
clrscr();
char data[1][9999];
int len,i,j,k,l,time,n;
printf("Enter any string\n");
gets(data[0]);
printf("How many times do you want the text to rotate?\n");
scanf("%d",&n);
len=strlen(data[0]);
printf("%d\n",len);
for (time=0;time<n;time++)
{ for (i=0,l=0;i<=len;i++,l++)
{ if (l>len)
l--;
clrscr();
for (j=i;j<len;j++)
{ printf("%c",data[0][j]);
}
printf(" ");
for (k=0;k<l;k++)
{ printf("%c",data[0][k]);
}
printf("\n");
delay(60);
}
}
getch();
}
One more thing, when I was trying to find a way to post the code without making it active, I got a new method that actually is supported by today's HTML standards. To post characters like "<" and ">" around codes or elements without making them active, you can just use their values that are used by HTML to show them.
They are:
For "<" - &-lt; [Without the "-"] For ">" - &-gt; [Without the "-"]
This is the method that I used to post the C Code in here. The page was failing to show the stdio.h and other modules like them between those characters as it was gulping it up as HTML code. So, I used those values instead of the direct characters and put the whole code in PRE tag. Pretty neat now it looks.