Search
 
SCRIPT & CODE EXAMPLE
 

CPP

Implement a currency converter which ask the user to enter value in Pak Rupees and convert in following: in cpp

#include<iostream>
#include<conio.h>
using namespace::std; 
main()
{
float Pakrupees;
int n;
float dollar,yen,euro,pound;
char ch,cha;

do
{
cout<<"Main menu"<<endl;
cout<<"select the mode of conversion"<<endl;
cout<<"enter 1 for the conversion of Pakistanirupees into one of the foreign currencies"<<endl;
cout<<"enter 2 for the conversion  of one of the foreign currencies into Pakistanirupees"<<endl;
cout<<"enter the mode:"<<endl;
cin>>n;

if(n==1)
{

cout<<"enter 'u' to get equivalent of your money in US Dollars"<<endl;
cout<<"enter 'p' to get equivalent of your noney in Pounds"<<endl;
cout<<"enter 'e' to get equivalent of your money in Euros"<<endl;
cout<<"enter 'y' to get equivalent of your money in Yen"<<endl;
cout<<"enter your choice:"<<endl;
cin>>ch;
cout<<"enter amount in Pakrupees:"<<endl;
cin>>Pakrupees;

switch(ch)
{
case 'u':
dollar=Pakrupees/59.44;
cout<<"US Dollar"<<"    "<<dollar<<endl;
break;
case 'p':
pound=Pakrupees/87.34;
cout<<"UK pound"<<"   "<<pound<<endl;
break;
case 'e':
euro=Pakrupees/69.00;
cout<<"eurpion union"<<"   "<<euro<<endl;
break;
case 'y':
yen=Pakrupees/0.02;
cout<<"japanes yen"<<"   "<<yen<<endl;
break;
default:
cout<<"wrong selection"<<endl;
}
}


if(n==2)
{
  cout<<"enter 'u' for getting equivalent of US Dolars in Pakistanirupees"<<endl;
cout<<"enter 'p' for getting equivalent of Pounds in Pakistanirupees"<<endl;
cout<<"enter 'e' for getting equivalent of Euros in Pakistanirupees "<<endl;
cout<<"enter 'y' for etting equivalent of Yen in Pakistanirupees"<<endl;
cout<<"enter your choice:"<<endl;
cin>>ch;
switch(ch)
{
case 'u':
cout<<"enter dollar"<<endl;
cin>>dollar;
Pakrupees=dollar*59.44;
cout<<"Pakrupees"<<"    "<<Pakrupees<<endl;
break;
case 'p':
cout<<"enter pounds"<<endl;
cin>>pound;
Pakrupees=pound*87.34;
cout<<"Pakrupees"<<"   "<<Pakrupees<<endl;
break;
case 'e':
cout<<"enter euro"<<endl;
cin>>euro;
Pakrupees=euro*69.00;
cout<<"Pakrupees"<<"   "<<Pakrupees<<endl;
break;
case 'y':
cout<<"enter yen"<<endl;
cin>>yen;
Pakrupees=yen*0.02;
cout<<"Pakrupees"<<"   "<<Pakrupees<<endl;
break;
default:
cout<<"wrong selection"<<endl;
}
}
cout<<"do you want to continue enter y/n"<<endl;
cin>>cha;
}
while(cha=='y'/'n') ;
getch();
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: find the mminimum of the vector and its position in c++ 
Cpp :: c++ start thread later 
Cpp :: Calcular el número mayor y menor C++ 
Cpp :: qt unhandled exception handler 
Cpp :: std::hash 
Cpp :: erase in c++ 
Cpp :: add integers 
Cpp :: can you use rand to read in from an external file inc++ 
Cpp :: draw point sfml 
Cpp :: github static std::string gen_name() { } // To do static int gen_number() { } // To do static int gen_grade() { } // To do double compute average() { } // To do 
Cpp :: How to clear keyboard buffer c++ 
Cpp :: test3 
Cpp :: count substrings codechef solution in c++ 
Cpp :: initialize multiple variables to 0 c++ 
Cpp :: cplusplus 
Cpp :: librerias matematicas en c++ para numeros aleatorios 
Cpp :: & before function arg in cpp 
Cpp :: inverse elment of array c++ 
Cpp :: skip headers while reading text 
Cpp :: sort sub vector, sort range of vector c++ 
Cpp :: patterns in c++ 
Cpp :: beecrowd problem 1001 solution 
Cpp :: online c++ compiler 
Cpp :: type casting in cpp 
Cpp :: iteration in c++ 
Cpp :: https://www.codegrepper.com 
Cpp :: how to get part from the vector cpp 
C :: reset style matplotlib 
C :: install gitk mac 
C :: check if string starts with c 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =