Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is my C code in putty. I am stuck on what I need to add to my code next. Your task is to write

This is my C code in putty. I am stuck on what I need to add to my code next.

image text in transcribedimage text in transcribed

Your task is to write a simple international currency converter. The converter will take an unformatted list of five allowable currencies, convert each to their equivalent in U.S. dollars, and print a final total when done. Your converter should understand dollars ('$'), Euros (''), British pounds sterling (''), the Japanese Yen (), and the Indian Rupee ('*'). You should use the getchar library function to read console input one character at a time. The use of any other library functions for input is not recommended at this time. We have provided an example program for your reference, executable on Morbius as brylow/os/Projects/money. Conversions Conversion rates between international currencies change on a daily basis. For the sake of simplicity, we will use the rates that were in effect the day this assignment specification was written: $1000 == 766 or 897 or \109940 or 370845. You may assume that only integer values of currency will be entered, and no decimal points will appear in the input. Likewise, please use only integer arithmetic operations to perform your conversion, and output only truncated integer dollars. (Note that this means an answer of $0.99 is still just output as $0.) const float POUND = 1.31; const float YEN = 0.0091; const float RUPEE = 0.014; const float EURO = 1.11; char c; int currval; float exchangeval; float finval; int printval; float currencyExvhane () { float exchangeRate = 1; c = getchar(); if (c == '$) { printf("s"); return exchangeRate; } else if (c ==' \xC2') { C = getchar(); if (c == '\xA3') { printf(""); exchangeRate = POUND; return exchangeRate; } else if (c == '\xA5') { printf(""); exchangeRate= YEN; 1/printf("the exchange rate is 3f", exchange Rate); 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 { //printf(unknown currency n"); "currencyex.c" 48L, 788C

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

If g(x, y) = xy - x, find gx and gy.

Answered: 1 week ago