Aktualizovat „du4/program.c“

This commit is contained in:
Bohdan Yanchyk 2020-04-03 07:19:49 +00:00
parent f01d7d2a30
commit 95b8458898

View File

@ -1,3 +1,6 @@
/*
gcc -Werror -std=c11 -Wall in-out.c -lm -o in-out -lm && ./in-out
*/
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@ -45,9 +48,9 @@ int main(){
if(cond<0){
printf("CHYBA\n");
return 0;}
/*if((fcond=checkend())!='\n'){
printf("1CHYBA %d\n",(int)fcond);
return 0;}*/
if((fcond=checkend())!='\n' && fcond>0){
printf("CHYBA\n");
return 0;}
if(fcond==-1)
break;
//printf("%lf %c %lf = %lf\n",list[i].na,list[i].sign,list[i].nb,list[i].result);
@ -70,9 +73,16 @@ char checkend(void){
while((c=getchar())){
++count;
if(c==EOF || c=='\n'){
int a=c;
if((c=getchar())==EOF){
++count;
fseek(stdin,-count,SEEK_CUR);
return c;
}
++count;
fseek(stdin,-count,SEEK_CUR);
return a;
}
else if(!isspace(c)){
fseek(stdin,-count,SEEK_CUR);
return c;