Question: I got the following errors. How do I fix them? My code so far is as follows: #include #include const float POUND = 1.31; const

I got the following errors. How do I fix them?

I got the following errors. How do I fix them? My code

My code so far is as follows:

so far is as follows: #include #include const float POUND = 1.31;

#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=NULL; struct node *poundHead=NULL; struct node *euroHead=NULL; struct node *yenHead=NULL; struct node *rupeeHead=NULL; struct node *head=NULL; void insert(float value){ struct node** head; if(value==POUND) { head=&poundHead; } else if(value==YEN) { head=&yenHead; } else if(value==RUPEE) { head=&rupeeHead; } else if(value==1) { head=&dollarHead; } else if(value==EURO) { head=&euroHead; } struct node* temp=(node*) malloc(sizeof(struct node)); printf("Enter value"); scanf("%d",&temp->value); temp->next=NULL; if(*head==NULL) { *head=temp; } else { temp->next=*head; *head=temp; } } void print(float value ) { struct node** head; if(value==POUND) { head=&poundHead; } else if(value==YEN) { head=&yenHead; } else if(value==RUPEE) { head=&rupeeHead } else if(value==1) { head=&dollarHead } else if(value==EURO) { head=&euroHead; } struct node* temp=*head; while(temp!=NULL) { printf("%d ",temp->value); temp=temp->next; } printf(" "); } int main(){ while(1) { float rate=currencyExchange(); if(rate==POUND) { insertpound(rate); } else if(rate==YEN) { insert(rate); } else if(rate==RUPEE) { insert(rate); } else if(rate==1) { insert(rate); } else if(rate==EURO) { insert(rate); } printf("Do you want to continue...if yes press Y else N"); char s; scanf("%c",&s); if(s=='Y' || s=='y') continue; else break; } printf("Pound currency "); print(POUND); printf("Yen currency "); print(YEN); printf("Rupee currency "); print(RUPEE); printf("Euro currency "); print(EURO); printf("Dollar currency "); print(1); } float exchangeValue(){ 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; } } } }

stackcurr.c:24:14: error: conflicting types for 'head' struct node *head=NULL; stackcurr.c:1:15: note: previous declaration of 'head' was here struct node** head; stackcurr.c: In function 'insert': stackcurr.c:47:20: error: 'node' undeclared (first use in this function), struct node* temp= (node*) malloc(sizeof (struct node)); stackcurr.c:47:20: note: each undeclared identifier is reported only once for each function it appears stackcurr.c:47:25: error: expected expression before token struct node* temp=(node*) malloc(sizeof(struct node)); stackcurr.c: In function 'print': stackcurr.c:75:1: error: expected ';' before 'j' token stackcurr.c:79:1: error: expected ';' before '' token stackcurr.c: At top level: stackcurr.c:135:7: error: 'exchangeValue' redeclared as different kind of symbol float exchangeValue() { stackcurr.c:11:7: note: previous declaration of 'exchangeValue' was here float exchangeValue; stackcurr.c: In function exchangeValue': stackcurr.c:140:15: error: 'exchangeRate' undeclared (first use in this function) return exchangeRate; stackcurr.c:170:63: error: expected declaration or statement at end of input Write a C program that reads in an arbitrarily long sequence of positive integer currency values in the style of Project 1), and outputs each category of currency in reverse order. Your converter should understand dollars ('S'), Euros (''), British pounds sterling (''), the Japanese Yen (''), and the Indian Rupee ('5'). This should reuse code from your previous project. Your program should ignore any amount of white space between currency values, including tabs, spaces, newlines, etc. See the isspace() function in your text or in the man pages for details. However, your output should place each currency value on a line by itself. When the end of input ("EOF") is reached, the piles should be printed in order of dollars, British pounds sterling, Japanese Yen, Euros, and finally Indian Rupees. To store an arbitrary list of integers, your program will need to request more memory from the operating system when the space it already has runs out. This kind of dynamic allocation is performed using the malloc() function, as detailed in your text and in the man pages. You may assume that we will test your program with at least 100,000,000 integers. Your program should exit gracefully if a malloc() request is denied

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!