-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInput_Check
More file actions
33 lines (27 loc) · 733 Bytes
/
Input_Check
File metadata and controls
33 lines (27 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdio.h>
#include <stdlib.h>
int Input_Check(double Coeff[], int* size, int* begin){
for(int i = *begin; i < 100; i++){
int c;
int check = scanf("%lg", &Coeff[i]);
if((c = getchar()) == '\n'){
*size = i + 1;
return 0;
}
if(check == 0){
printf("Please, try to input %d coefficient once more: ", i + 1);
*begin = i - 1;
return 1;
}
}
}
int main()
{
double Coeff[100] = {0};
int size = 0;
int begin = 0;
int prov = 7;
while((prov = Input_Check(Coeff, &size, &begin)) != 0) Input_Check(Coeff, &size, &begin);
for(int i = 0; i < size; i++) printf("%lg ", Coeff[i]);
return 0;
}