Изменил(а) на 'du3/program.c'
This commit is contained in:
parent
a0a40567d3
commit
ba3e148434
@ -5,6 +5,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#define LINE_SIZE 150
|
#define LINE_SIZE 150
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
char riadok[LINE_SIZE];
|
char riadok[LINE_SIZE];
|
||||||
memset(riadok, 0,LINE_SIZE);
|
memset(riadok, 0,LINE_SIZE);
|
||||||
@ -21,14 +22,10 @@ int main(){
|
|||||||
//float p = 0;
|
//float p = 0;
|
||||||
while(stop == 0){
|
while(stop == 0){
|
||||||
r = fgets(riadok,LINE_SIZE,stdin);
|
r = fgets(riadok,LINE_SIZE,stdin);
|
||||||
if(feof(stdin)){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pos++;
|
pos++;
|
||||||
|
if (r == NULL || !isdigit(*r) || *r == EOF) {
|
||||||
if (r == NULL || !isdigit(*r) || *r == EOF || feof(stdin)) {
|
|
||||||
//printf("%d", *r);
|
//printf("%d", *r);
|
||||||
if(*r == 10){
|
if(*r == 10 || r == NULL){
|
||||||
stop = 1;
|
stop = 1;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -42,12 +39,17 @@ int main(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (*r == EOF) {
|
||||||
|
stop = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
r2 = atof(riadok);
|
r2 = atof(riadok);
|
||||||
mass[i] = r2;
|
mass[i] = r2;
|
||||||
//printf("%.2f\n", r2);
|
//printf("%.2f\n", r2);
|
||||||
i++;
|
i++;
|
||||||
//printf("%d\n", i);
|
//printf("%d\n", i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
x = mass[0];
|
x = mass[0];
|
||||||
vysl = x;
|
vysl = x;
|
||||||
//printf("%d\n", x);
|
//printf("%d\n", x);
|
||||||
|
Loading…
Reference in New Issue
Block a user