Try to figure out what this program does by looking at it and tracing (in your head or on paper) it rather than running it. Pretend you are the computer! Once you think you know what it does, run the program by using your own editor, saving on the server and compiling there.
Compile and run the code below in your own C environment.
#include <stdio.h>
int main(void)
{
char letter;
unsigned long i;
unsigned long num = 100000;
printf("\n Processing data... ");
for (i=0; i<num; i++) {
switch (i%4) {
case 0: letter = '/'; break;
case 1: letter = '-'; break;
case 2: letter = '\\'; break;
case 3: letter = '|'; break;
}
printf("%c\b",letter);
fflush(stdout);
}
printf("\b \n done.\n");
return(0);
}
Compile and run the code below in your own C environment.
#include <stdio.h>
int main(void)
{
char letter;
unsigned long i;
unsigned long num = 100000;
printf("\n Processing data... ");
for (i=0; i<num; i++) {
switch (i%4) {
case 0: letter = '/'; break;
case 1: letter = '-'; break;
case 2: letter = '\\'; break;
case 3: letter = '|'; break;
}
printf("%c\b",letter);
fflush(stdout);
}
printf("\b \n done.\n");
return(0);
}