2021-10-21 18:53:21 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#define velkost 10
|
|
|
|
|
|
|
|
struct zasobnik {
|
|
|
|
float price;
|
|
|
|
};
|
|
|
|
|
|
|
|
int main() {
|
2021-10-21 20:03:57 +00:00
|
|
|
struct zasobnik databaza[velkost];
|
|
|
|
char input[100]= {0};
|
|
|
|
int number = 0;
|
|
|
|
int counter = 0;
|
2021-10-21 18:53:21 +00:00
|
|
|
|
2021-10-21 20:03:57 +00:00
|
|
|
while(fgets(input, sizeof(input), stdin) && strcmp( input, "\n" ) != 0 ){
|
|
|
|
number = strtof(input, NULL);
|
|
|
|
databaza[counter].price = number;
|
2021-10-21 18:53:21 +00:00
|
|
|
|
2021-10-21 20:03:57 +00:00
|
|
|
if(input[0] == '+'){
|
2021-10-21 20:05:25 +00:00
|
|
|
printf("%.2f \n",databaza[counter-2].price);
|
|
|
|
printf("%.2f %.2f \n",databaza[counter-2].price, databaza[counter-1].price);
|
2021-10-21 20:03:57 +00:00
|
|
|
databaza[counter-2].price = databaza[counter-2].price + databaza[counter-1].price;
|
2021-10-21 20:05:25 +00:00
|
|
|
printf("%.2f \n",databaza[counter-2].price);
|
2021-10-21 20:03:57 +00:00
|
|
|
}
|
|
|
|
if(input[0] == '-'){
|
2021-10-21 20:05:25 +00:00
|
|
|
printf("%.2f \n",databaza[counter-2].price);
|
|
|
|
printf("%.2f %.2f \n",databaza[counter-2].price, databaza[counter-1].price);
|
2021-10-21 20:03:57 +00:00
|
|
|
databaza[counter-2].price = databaza[counter-2].price - databaza[counter-1].price;
|
2021-10-21 20:05:25 +00:00
|
|
|
printf("%.2f \n",databaza[counter-2].price);
|
2021-10-21 20:03:57 +00:00
|
|
|
}
|
|
|
|
if(input[0] == '/'){
|
2021-10-21 20:05:25 +00:00
|
|
|
printf("%.2f \n",databaza[counter-2].price);
|
|
|
|
printf("%.2f %.2f \n",databaza[counter-2].price, databaza[counter-1].price);
|
2021-10-21 20:03:57 +00:00
|
|
|
databaza[counter-2].price = databaza[counter-2].price / databaza[counter-1].price;
|
2021-10-21 20:05:25 +00:00
|
|
|
printf("%.2f \n",databaza[counter-2].price);
|
2021-10-21 20:03:57 +00:00
|
|
|
}
|
|
|
|
if(input[0] == '*'){
|
2021-10-21 20:05:25 +00:00
|
|
|
printf("%.2f \n",databaza[counter-2].price);
|
|
|
|
printf("%.2f %.2f \n",databaza[counter-2].price, databaza[counter-1].price);
|
2021-10-21 20:03:57 +00:00
|
|
|
databaza[counter-2].price = databaza[counter-2].price * databaza[counter-1].price;
|
2021-10-21 20:05:25 +00:00
|
|
|
printf("%.2f \n",databaza[counter-2].price);
|
2021-10-21 20:03:57 +00:00
|
|
|
}
|
|
|
|
counter++;
|
|
|
|
}
|
|
|
|
printf("no input\n");
|
2021-10-21 18:53:21 +00:00
|
|
|
}
|