Answered Essay: Make a report to explain each step in this Dev C++ prog. including introduction,steps of the program , discussion and conclusion :

Make a report to explain each step in this Dev C++ prog. including introduction,steps of the program , discussion and conclusion :

#include<iostream>
using namespace std;
int main()
{
double MYR,conv,ch,cont=1;
while(cont!=0)
{
cout<<“1.To Singapore dollar (SGD)n2.To United States Dollar (MYR)n3.To Australia Dollar (AUD)n4.Euro (EUR)n5.To India RupeenEnter choice : “;
cin>>ch;
if(ch>=1 && ch<=5)
{
cout<<“Enter Malaysia Ringgit (MYR) amount : “;
cin>>MYR;
if(MYR!=0)
{
if(ch==1)
conv=MYR*0.32;
else if(ch==2)
conv=MYR*0.23;
else if(ch==3)
conv=MYR*0.29;
else if(ch==4)
conv=MYR*0.20;
else if(ch==5)
conv=MYR*14.89;
cout<<“converted value is : “<< conv <<endl;
}
else if(MYR==0)
cout<<“Enter non-zero value.”;
}
if(ch<1 || ch>5)
cout<<“Wrong choice.n”;
cout<<“Do you want to continue?(1->YES || 0->NO) : “;
cin>>cont;
cout<<“n”;
}
}

Expert Answer

 

Introduction:

This program converts the Malaysia Ringgit (MYR) into the following currency:

1.     Singapore Dollar (SGD).

2.     United States Dollar (USD).

3.     Australia Dollar (AUD).

4.     Euro (EUR).

5.     India Rupee.

Steps and working of the program:

·       The program displays the menu which contains the above currencies and allows the user to choose the currency from the menu.

·       Then, according to the user choice, it converts the MYR into the other country’s currency.

·       The program also uses the while loop for the following reason.

o   If the user wants to convert the MYR into the two or more currencies, then it also allows the user to convert into two or more currencies.

#include<iostream>                              //Line1

using namespace std;                            //Line2

int main()                                      //Line3

{                                               //Line4

double MYR,conv,ch,cont=1;                      //Line5

while(cont!=0)                                  //Line6

{                                               //Line7

cout<<“1.To Singapore dollar (SGD)n2.To United States Dollar (MYR)n3.To Australia Dollar (AUD)n4.Euro (EUR)n5.To India RupeenEnter choice : “;     //Line8

cin>>ch;                                        //Line9

if(ch>=1 && ch<=5)                              //Line10

{                                               //Line11

cout<<“Enter Malaysia Ringgit (MYR) amount : “; //Line12

cin>>MYR;                                       //Line13

if(MYR!=0)                                      //Line14

{                                               //Line15

if(ch==1)                                       //Line16

conv=MYR*0.32;                                  //Line17

else if(ch==2)                                  //Line18

conv=MYR*0.23;                                  //Line19

else if(ch==3)                                  //Line20

conv=MYR*0.29;                                  //Line21

else if(ch==4)                                  //Line22

conv=MYR*0.20;                                  //Line23

else if(ch==5)                                  //Line24

conv=MYR*14.89;                                 //Line25

cout<<“converted value is : “<< conv <<endl;    //Line26

}                                               //Line27

else if(MYR==0)                                 //Line28

cout<<“Enter non-zero value.”;                  //Line29

}                                               //Line30

if(ch<1 || ch>5)                                //Line31

cout<<“Wrong choice.n”;                        //Line32

cout<<“Do you want to continue?(1->YES||0->NO):”; //Line33

cin>>cont;                                      //Line34

cout<<“n”;                                     //Line35

}                                               //Line36

}                                               //Line37

Explanation and discussion step by step:

·       Line1 includes the header file iostream which is used for input/output operations.

·       Line2 of this program uses the namespace std which is used for cin, cout.

·       Main function starts from line number 3.

·       Variables MYR, conv, ch of type double declare at line5 and the variable cont declares and initializes to “1” at line5.

·       While loop starts from line6. It will run till the value of cont becomes 0.

·       Menu displays at line8.

·       Line9 prompts the user to enter the choice and stores the value in the variable ch.

·       Line10 checks the condition whether the user enter the provide the right choice or not. If condition checks whether the value of ch is greater than 1 and less than 5 or not. If choice is not greater than 1 and less than 5, then execution will go at line31.

·       Line13 prompts the user to enter the Malaysia Ringgit (MYR) amount and stores the value into the variable MYR.

·       Line15 checks whether the entered amount is 0 or not. If the entered amount is 0, then execution of the program will go at line28.

·       If the user entered the choice 1, then program converts the MYR into Singapore Dollar by multiplying.32 to MYR and stores the value into conv.

·       If the user entered the choice 2, then program converts the MYR into United States Dollar by multiplying .23 to MYR and stores the value into conv.

·       If the user entered the choice 3, then program converts the MYR into Australia Dollar by multiplying.29 to MYR and stores the value into conv.

·       If the user entered the choice 4, then program converts the MYR into Euro by multiplying .20 to MYR and stores the value into conv.

·       If the user entered the choice 4, then program converts the MYR into Indian Rupee by multiplying14.89 to MYR and stores the value into conv.

·       The converted value displays at line29.

·       Line35 prompts the user whether to continue or not and stores the value into cont.

·       If the value of cont is 1, then the execution of the program will go at line6. Otherwise, the program will terminate.

Conclusion:

Thus, with the help of this program one can easily converts the MRY into other countries currency.

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?