Оновити 'cv3/program.c'

This commit is contained in:
Kapliuk 2024-03-06 20:49:43 +00:00
parent 75ec7c77e3
commit 8abc55c62b

View File

@ -6,12 +6,14 @@
int main(){
char line[LENGTH];
int cfIdx, cf1 = 0;
char *y, *chcf;
int cfIdx, cf1, y1,x1,chcf1 = 0;
double x, cf,result = 0;
fgets(line, 100, stdin);
fgets(line, 100, stdin);
y = strtok(line,"\n");
x = strtod(line, NULL);
cf1 = ceil(x);
if(cf1 == 0 && line[0] != '\n' && x != 0.0){
y1 = *y;
if(y1 >= 'A' && line[0] != '\n'){
printf("Nepodarilo sa nacitat zaklad x\n");
return 1;
}
@ -19,10 +21,11 @@ int main(){
cfIdx++;
result = result * x + cf;
fgets(line, 100, stdin);
chcf = strtok(line,"\n");
cf = strtod(line,NULL);
cf1 = ceil(cf);
if(cf1 == 0 && line[0] != '\n' && cf != 0.0){
printf("\nNepodarilo sa nacitat polynom na %d mieste.\n", cfIdx);
chcf1 = *chcf;
if(chcf1 >='A' && line[0] != '\n'){
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", cfIdx);
return 1;
}
}