diff options
author | Matt Strapp <matt@mattstrapp.net> | 2022-05-24 11:18:46 -0500 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2022-05-24 11:19:55 -0500 |
commit | 7a73162607544204032aa66cce755daf21edebda (patch) | |
tree | 58578e01f15f34a855d99c32898db9d7a1603e67 /csci5271/hw1/hw1p3.c | |
parent | do some stuff (diff) | |
download | homework-7a73162607544204032aa66cce755daf21edebda.tar homework-7a73162607544204032aa66cce755daf21edebda.tar.gz homework-7a73162607544204032aa66cce755daf21edebda.tar.bz2 homework-7a73162607544204032aa66cce755daf21edebda.tar.lz homework-7a73162607544204032aa66cce755daf21edebda.tar.xz homework-7a73162607544204032aa66cce755daf21edebda.tar.zst homework-7a73162607544204032aa66cce755daf21edebda.zip |
Graduate
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to 'csci5271/hw1/hw1p3.c')
-rw-r--r-- | csci5271/hw1/hw1p3.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/csci5271/hw1/hw1p3.c b/csci5271/hw1/hw1p3.c new file mode 100644 index 0000000..53ecc96 --- /dev/null +++ b/csci5271/hw1/hw1p3.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <string.h> + +void payment(char *name, double amount_cny, char *purpose, int purpose_len) +{ + double amount_usd = amount_cny / 6.466; + char memo[40]; + strcpy(memo, "Payment for: "); + memcpy(memo + strlen(memo), purpose, purpose_len); + //write_check(name, amount_usd, memo); + printf("address of amount_usd: %p\naddress of memo: %p\n", &amount_usd, memo); + printf("purpose_len: %d\n", purpose_len); + printf("amount_usd: %f\npurpose: %s\n", amount_usd, purpose); + return; +} + +int main() +{ + char name[] = "username"; + double amount_cny = 646.60; + char purpose[] = "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"; + int purpose_len = strlen(purpose); + payment(name, amount_cny, purpose, purpose_len); + return 0; +}
\ No newline at end of file |