|
Revision 1219, 1.1 kB
(checked in by alpt, 1 year ago)
|
improved
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
#include <stdlib.h> |
|---|
| 10 |
#include <string.h> |
|---|
| 11 |
#include <unistd.h> |
|---|
| 12 |
#include <stdio.h> |
|---|
| 13 |
|
|---|
| 14 |
int main() |
|---|
| 15 |
{ |
|---|
| 16 |
char alpt[]="1234567890abcdef"; |
|---|
| 17 |
char small[80]; |
|---|
| 18 |
int y,i,len; |
|---|
| 19 |
|
|---|
| 20 |
len=strlen(alpt); |
|---|
| 21 |
for(y=0; y!=len+1;y++) { |
|---|
| 22 |
strncpy(small, alpt, 80); |
|---|
| 23 |
small[79]=0; |
|---|
| 24 |
printf("\r%s", small); |
|---|
| 25 |
fflush(stdout); |
|---|
| 26 |
sift(alpt,len); |
|---|
| 27 |
usleep(90000); |
|---|
| 28 |
} |
|---|
| 29 |
printf("\n"); |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
int sift(char *alpt, int len) |
|---|
| 43 |
{ |
|---|
| 44 |
int i; |
|---|
| 45 |
|
|---|
| 46 |
for(i=len; i!=-1; i--) |
|---|
| 47 |
if((i-1)<0) |
|---|
| 48 |
alpt[i]=alpt[len]; |
|---|
| 49 |
else |
|---|
| 50 |
alpt[i]=alpt[i-1]; |
|---|
| 51 |
alpt[len]='\0'; |
|---|
| 52 |
} |
|---|