Simple Currency Convertor using C++

How to create a Simple Currency Converter using C++

Hello learners, Creating a Simple Currency Converter is very interesting too using C++. Today at codewithrandom we are gonna learn currency converter program in C++ with proper source code.

Read also: Build A Currency Converter in Python

Simple currency converter

What is a currency converter?

A Simple currency converter system in C++ in a simple console application that converts the value of one currency into another. It allows the users to simply calculate the conversion rate between multiple currencies. A system like this would require up-to-date currency exchange rates which may maybe obtained from external sources or databases to ensure that the Currency Convertor system provides the users with accurate conversions. We can also call it a money converter.

This type of system is often used by international travelers, global businesses, and financial institutions to convert and track currencies.

Simple Currency Convertor using C++

Credit Card Validator using C++ (With Source Code)

So, here in this article, we will be creating a simple currency converter system that allows the users to enter an amount in US dollars and then convert it to British Pounds, French francs, German Dutchmarks, and Japanese Yen.

Overview of the UI:

  • Enter the dollars for conversion:

After entering the dollars, we will get the converted currencies as a result.

Simple Currency Converter using C++ Source code:

You can directly use this code by copying it into your IDE to understand the work and then create it by understanding the project.

#include<iostream>

using namespace std;

int main()

{

            float dollar;

            float bp=(1/1.487);

            float frnc=(1/0.172);

            float dutchmark=(1/0.584);

            float yen=(1/0.00955);

            cout<<"Enter the Dollars for Conversion :\n";

            cin>>dollar;

            cout<<"British Pounds :"<<bp*dollar<<endl;

            cout<<"French franc :"<<frnc*dollar<<endl;

            cout<<"German Dutchmark :"<<dutchmark*dollar<<endl;

            cout<<"Japanese Yen :"<<yen*dollar<<endl;

            return 0;

}

Now let us understand the code:-

  • We will start by writing the header of the code with the iostream library (standard input-output stream) and declare the namespace std.
  •  We will define the main() function which will return an integer value. We will declare a variable called ‘dollar’ which will get converted to other currencies and currencies with the constant exchange rates will be written. These will all be of floating point type.
  • Then we will write a statement using ‘cout’ asking the user to enter the Dollars for conversion, the input will be read using the cin statement and stored in the ‘dollar’ variable.
  • After the user enters the ‘dollar’, the system will then calculate the equivalent amount of money in each of the four currencies by multiplying the conversion rates with the user’s input and printing the results on the console using the ‘cout’ statement. The main function will return 0, indicating that the program has run successfully and terminated.
  • This sums up our project of a Simple Currency Convertor system using C++.

Base Converter project using C++ (With source code)

Final Output:-

Here is an example to show how this project works

  • Entered US dollar amount = 50. The converted currencies are displayed as a result.
Simple Currency Convertor using C++

Conclusion

We have reached the end of this article and have a lot more projects in C++ coming so stay tuned. We have started with awesome and fun projects for you all to understand C++. Learning C++ by creating fun projects makes learning easy and interesting.

Chess Game Using C++ (With Source Code)

If you enjoyed the article and learned something new today, let us know in the comments.

FAQ related to currency converter

What is a C++ currency converter?

A Simple currency converter system in C++ in a simple console application that converts the value of one currency into another. It allows the users to simply calculate the conversion rate between multiple currencies.

Is the currency converter project in C++ responsive?

yes

Thank you.

Happy Reading! 🙂

Follow: CodeWithRandom



Leave a Reply