Сделал 22 Задание
This commit is contained in:
parent
973e407a45
commit
2e4417c1dc
7 changed files with 97 additions and 0 deletions
21
22Ex/make_increasing.c
Normal file
21
22Ex/make_increasing.c
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "make_increasing.h"
|
||||
|
||||
int makeIncreasing(FILE * file) {
|
||||
double current, next;
|
||||
unsigned short used = 0;
|
||||
|
||||
if (fscanf(file, "%lf", ¤t) != 1) {
|
||||
printf("File is empty!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (fscanf(file, "%lf", &next) == 1) {
|
||||
if ((next - current) < DISREG) {
|
||||
if (used == TRUE) return 0;
|
||||
used = TRUE;
|
||||
}
|
||||
current = next;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue