Изменил(а) на 'du3/program.c'
This commit is contained in:
parent
d8f6e0ec03
commit
38fcde55b5
@ -20,19 +20,19 @@ int main(){
|
|||||||
int pos = -1;
|
int pos = -1;
|
||||||
//float p = 0;
|
//float p = 0;
|
||||||
while(stop == 0){
|
while(stop == 0){
|
||||||
if(feof(stdin)){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
r = fgets(riadok,LINE_SIZE,stdin);
|
r = fgets(riadok,LINE_SIZE,stdin);
|
||||||
pos++;
|
pos++;
|
||||||
if(feof(stdin)){
|
if (r == NULL || !isdigit(*r) || feof(stdin)) {
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (r == NULL || !isdigit(*r)) {
|
|
||||||
//printf("%d", *r);
|
//printf("%d", *r);
|
||||||
if(*r == 10){
|
if(*r == 10){
|
||||||
stop = 1;
|
stop = 1;
|
||||||
}
|
}
|
||||||
|
if(feof(stdin)){
|
||||||
|
stop = 1;
|
||||||
|
r2 = atof(riadok);
|
||||||
|
mass[i] = r2;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
if(pos > 0){
|
if(pos > 0){
|
||||||
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", pos);
|
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", pos);
|
||||||
@ -52,20 +52,20 @@ int main(){
|
|||||||
}
|
}
|
||||||
x = mass[0];
|
x = mass[0];
|
||||||
vysl = x;
|
vysl = x;
|
||||||
//printf("%d\n", x);
|
printf("x>>>>>%1.f\n", x);
|
||||||
if(i != 3 || mass[1] == 4){
|
if(i != 3 || mass[1] == 4){
|
||||||
for(int j = 1; j < i - 1; j++){
|
for(int j = 1; j < i - 1; j++){
|
||||||
h = mass[j];
|
h = mass[j];
|
||||||
//printf("h>>> %1.f\n", h);
|
printf("h>>> %1.f\n", h);
|
||||||
if(counter == -1){
|
if(counter == -1){
|
||||||
vysl = x * h + mass[j + 1];
|
vysl = x * h + mass[j + 1];
|
||||||
//printf("vysl>>> %1.f\n", vysl);
|
printf("vysl>>> %1.f\n", vysl);
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(j != i - 2){
|
if(j != i - 2){
|
||||||
vysl = x * vysl + mass[j + 1];
|
vysl = x * vysl + mass[j + 1];
|
||||||
//printf("vysl22>>>>> %1.f\n", vysl);
|
printf("vysl22>>>>> %1.f\n", vysl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,10 +73,5 @@ int main(){
|
|||||||
else{
|
else{
|
||||||
vysl = mass[1];
|
vysl = mass[1];
|
||||||
}
|
}
|
||||||
if(vysl == 6.58){
|
|
||||||
printf("Vysledok je: 10.84");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
printf("Vysledok je: %.2f\n", vysl);
|
printf("Vysledok je: %.2f\n", vysl);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user