test
This commit is contained in:
parent
082ff00be7
commit
2473430d3a
BIN
cv3/program
BIN
cv3/program
Binary file not shown.
@ -9,15 +9,43 @@
|
|||||||
|
|
||||||
struct zasobnik {
|
struct zasobnik {
|
||||||
float price;
|
float price;
|
||||||
int size;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
//struct zasobnik databaza[velkost];
|
struct zasobnik databaza[velkost];
|
||||||
//char input[100]= {0};
|
char input[100]= {0};
|
||||||
|
int number = 0;
|
||||||
|
int counter = 0;
|
||||||
|
|
||||||
//while(fgets(input, sizeof(input), stdin) && strcmp( input, "\n" ) != 0 ){
|
while(fgets(input, sizeof(input), stdin) && strcmp( input, "\n" ) != 0 ){
|
||||||
|
number = strtof(input, NULL);
|
||||||
//}
|
databaza[counter].price = number;
|
||||||
|
|
||||||
|
if(input[0] == '+'){
|
||||||
|
printf("%.2f\n",databaza[counter-2].price);
|
||||||
|
printf("%.2f %.2f\n",databaza[counter-2].price, databaza[counter-1].price);
|
||||||
|
databaza[counter-2].price = databaza[counter-2].price + databaza[counter-1].price;
|
||||||
|
printf("%.2f\n",databaza[counter-2].price);
|
||||||
|
}
|
||||||
|
if(input[0] == '-'){
|
||||||
|
printf("%.2f\n",databaza[counter-2].price);
|
||||||
|
printf("%.2f %.2f\n",databaza[counter-2].price, databaza[counter-1].price);
|
||||||
|
databaza[counter-2].price = databaza[counter-2].price - databaza[counter-1].price;
|
||||||
|
printf("%.2f\n",databaza[counter-2].price);
|
||||||
|
}
|
||||||
|
if(input[0] == '/'){
|
||||||
|
printf("%.2f\n",databaza[counter-2].price);
|
||||||
|
printf("%.2f %.2f\n",databaza[counter-2].price, databaza[counter-1].price);
|
||||||
|
databaza[counter-2].price = databaza[counter-2].price / databaza[counter-1].price;
|
||||||
|
printf("%.2f\n",databaza[counter-2].price);
|
||||||
|
}
|
||||||
|
if(input[0] == '*'){
|
||||||
|
printf("%.2f\n",databaza[counter-2].price);
|
||||||
|
printf("%.2f %.2f\n",databaza[counter-2].price, databaza[counter-1].price);
|
||||||
|
databaza[counter-2].price = databaza[counter-2].price * databaza[counter-1].price;
|
||||||
|
printf("%.2f\n",databaza[counter-2].price);
|
||||||
|
}
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
printf("no input\n");
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user