Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
4
Task/Currency/C/currency-1.c
Normal file
4
Task/Currency/C/currency-1.c
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
mpf_set_d(burgerUnitPrice,5.50);
|
||||
mpf_set_d(milkshakePrice,2 * 2.86);
|
||||
mpf_set_d(burgerNum,4000000000000000);
|
||||
mpf_set_d(milkshakeNum,2);
|
||||
1
Task/Currency/C/currency-2.c
Normal file
1
Task/Currency/C/currency-2.c
Normal file
|
|
@ -0,0 +1 @@
|
|||
mpf_set_str(tax,"0.0765",10);
|
||||
29
Task/Currency/C/currency-3.c
Normal file
29
Task/Currency/C/currency-3.c
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include<stdio.h>
|
||||
#include<gmp.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
mpf_t burgerUnitPrice, milkshakePrice, burgerTotalPrice, totalPrice, tax, burgerNum, milkshakeNum;
|
||||
|
||||
mpf_inits(burgerUnitPrice, milkshakePrice, burgerTotalPrice, totalPrice, tax,burgerNum, milkshakeNum,NULL);
|
||||
|
||||
mpf_set_d(burgerUnitPrice,5.50);
|
||||
mpf_set_d(milkshakePrice,2 * 2.86);
|
||||
mpf_set_d(burgerNum,4000000000000000);
|
||||
mpf_set_d(milkshakeNum,2);
|
||||
|
||||
mpf_mul(burgerTotalPrice,burgerNum,burgerUnitPrice);
|
||||
mpf_add(totalPrice,burgerTotalPrice,milkshakePrice);
|
||||
|
||||
mpf_set_str(tax,"0.0765",10);
|
||||
mpf_mul(tax,totalPrice,tax);
|
||||
|
||||
gmp_printf("\nTotal price before tax : $ %.*Ff", 2, totalPrice);
|
||||
gmp_printf("\nTotal tax : $ %.*Ff", 2, tax);
|
||||
|
||||
mpf_add(totalPrice,totalPrice,tax);
|
||||
|
||||
gmp_printf("\nTotal price after tax : $ %.*Ff", 2, totalPrice);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue