home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Inne
/
Gry
/
Atomic_Tanks
/
Atomic-Tanks-5.1.exe
/
exporter
/
move.cpp
< prev
Wrap
C/C++ Source or Header
|
2009-10-11
|
607b
|
36 lines
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int highest, lowest;
int current;
char command[256];
if (argc < 3)
{
printf("Usage: move highest_number lowest_number\n\n");
return 1;
}
sscanf(argv[1], "%d", &highest);
sscanf(argv[2], "%d", &lowest);
if (highest <= lowest)
{
printf("Values are not in right order.\n\n");
return 1;
}
current = highest;
while (current >= lowest)
{
sprintf(command, "mv %d.bmp %d.bmp", current, current + 1);
system(command);
current--;
}
return 0;
}