diff --git a/cv3/program.c b/cv3/program.c index 45770d3..0421a34 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -7,31 +7,27 @@ int main() { - float result_of_main; - float x,a,b,c; - int result=reading_input(&x); + float result_of_main=0; + float array_of_numbers[SIZE_OF_ARRAY]; + int counter=0; + int result; + while(1){ + float x=0; + result=reading_input(&x); + if(result==0||result==2){ + break; + } + array_of_numbers[counter]=x; + counter++; + } if(result==0){ - printf("x"); return 0; } - result=reading_input(&a); - if(result==0){ - printf("a"); - return 0; + for(int j=1; j='0'&&buffer[j]<='9') { continue; } - if (buffer[j]=='.'||buffer) { + if (buffer[j]=='.') { continue; } if(buffer[j]=='\n'){ @@ -51,7 +47,9 @@ int reading_input(float *number){ printf("You have entered wrong number.\n"); return 0; } + if(buffer[0]=='\0'){ + return 2; + } *number=atof(buffer); return 1; } -