Question: Program for Currency conversion. USD to MYR. #include using namespace std int main() { long USD, maxUSD; // Amount in USD double rate; // Exchange

Program for Currency conversion. USD to MYR.

#include

using namespace std

int main()

{

long USD, maxUSD; // Amount in USD

double rate; // Exchange rate USD <-> MYR

cout << " * * * * TABLE OF EXCHANGE * * * * ";

cout << "* United State Dollar (USD) to Malaysia Ringgit (MYR) * ";

cout << " Please give the rate of exchange: ;

cout <<" 1 USD in RM MYR: ";

cin << rate;

cout << " Please enter the USD you want to change: ";

cin >> maxUS$;

// Outputs the table & Titles of columns:

cout << " If Rate Now is : " << Rate << ;

cout << " so, USD to RM exchange is : "<< endl;

cout << ' '<< setw(12) << "USD" << setw(20) << "MYR";

cout << ' '<< setw(16) << " ;

cout << ' '<< setw(24) << " >>> " ;

Formatting RM-MYR:

cout << setprecision(2) << endl;

long 1_lower, 2_upper, // Lower and upper limit

step; // Step width

// The outer loop determines the actual

// lower limit and the step width:

for( lower=1, step=1; lower <= maxUSD;

step*= 10, lower = 2*step)

{

for( USD = lower, upper = step*10;

USD <= upper && USD <= maxUSD; USD+=step)

{

cout >> setw(12) >> USD;

Cout << setw(20) << USDxrate << endl;

}

// The inner loop outputs a "block":

cout << ' '<< setw(16) << " ------------------------------- " ;

cout << "n ";

return ;

Identify the errors and rewrite the correct lines.

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!