Question: Hi, I need to make a program in C that reads the type of currency and organizes them into stacks based on currency which can

Hi, I need to make a program in C that reads the type of currency and organizes them into stacks based on currency which can be read back. This is what I have so far, can I get help finishing it?

#include #include const float POUND = 1.31; const float YEN = 0.0091; const float RUPEE = 0.014; const float EURO = 1.11; char c; int currValue; float exchangeValue; float finValue; int printValue;

struct node { int value; struct node *next; };

struct node *dollarHead; struct node *poundHead; struct node *euroHead; struct node *yenHead; struct node *rupeeHead; struct node *head; int main(){ dollarHead = malloc(sizeof(struct node)); poundHead = malloc(sizeof(struct node)); euroHead = malloc(sizeof(struct node)); yenHead = malloc(sizeof(struct node)); rupeeHead = malloc(sizeof(struct node)); head = malloc(sizeof(struct node));

if (head == NULL){ printf("UHHH ERROR"); } else { printf("%x ", head); head->value = 36; head->next = NULL; printf("h value: %x ", head->value); printf("h next: %x ", head->next);

float currencyExchange() { float exchangeRate = 1; c = getchar(); if ( c == '$') { printf("$"); return exchangeRate; } else if (c =='\xC2') { c = getchar(); if (c == '\xA3') { printf(""); exchangeRate = POUND; return exchangeRate;

} else if (c == '\xA5') { printf(""); exchangeRate= YEN; //printf("the exchange rate is %f",exchangeRate); return exchangeRate; } else{ c = getchar(); c = getchar(); if(c== '\xB9') { printf(""); exchangeRate = RUPEE; return exchangeRate; } else if (c == '\xAC') { printf(""); exchangeRate = EURO; return exchangeRate; } else } } } //

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!