What are you compiling on?
If you're on Windows, replace the clrscr() with system("cls");. Also, remove the clrscr() function as you're not calling it anymore. You can call the screen clearing options of the operating system you're running on. Otherwise, the only way to make that thing seem like it's spinnnig is by creating an extra function to make sure each character gets drawn in the same exact spot.
Simpler way? Size of the code. Messing around with your program I came up with this:
Code:
#include <stdio.h>
#include <windows.h>
void gotoxy( int x, int y );
void clrscr(void);
int main()
{
long counter1,counter2,towait;
char anim[5]="|\\-/";
clrscr();
for(counter1=0;counter1<10000;counter1++)
{
for(counter2=0;counter2<5;counter2++)
{
gotoxy( 0, 0 ); /* clear screen, change it prefered */
printf("%c",anim[counter2]);
printf("\n\nHmmm...");
for(towait=0;towait<15000000;towait++)
{
continue;
}
}
}
}
void gotoxy ( int x, int y )
{
COORD coord;
CONSOLE_CURSOR_INFO c = { 1, 0 };
coord.X = (short)x;
coord.Y = (short)y;
SetConsoleCursorPosition ( GetStdHandle ( STD_OUTPUT_HANDLE ), coord );
SetConsoleCursorInfo ( GetStdHandle ( STD_OUTPUT_HANDLE ), &c );
}
void clrscr(void)
{
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole, TEXT(' '),
dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes,
dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hConsole, coordScreen);
}
I have decided that I like this best. There probably are several ways to do this that are much simpler. Who's to say that they are the correct way though?