30 lines
519 B
C
30 lines
519 B
C
#include <stdio.h>
|
|
|
|
int main( int argc, char *argv[] ){
|
|
if( argc == 2 ) {
|
|
|
|
unsigned int last = ~0;
|
|
unsigned int increasing = 0;
|
|
unsigned int value;
|
|
|
|
// Read the values into an array
|
|
FILE *fp=fopen(argv[1], "r");
|
|
while (!feof (fp)){
|
|
fscanf(fp, "%d\n", &value);
|
|
|
|
printf( "value %d\n", value );
|
|
if ( value > last )
|
|
increasing++;
|
|
last = value;
|
|
}
|
|
fclose(fp);
|
|
|
|
|
|
printf( "%d were increasing\n", increasing );
|
|
|
|
return 0;
|
|
} else {
|
|
printf("You need to provide a file\n");
|
|
return 1;
|
|
}
|
|
}
|