Docstoc

cs201 (DOC)

Document Sample
cs201 (DOC) Powered By Docstoc
					/* Assignment # 1 CS 201

*/

# include <iostream.h>
# include <conio.h>

main ()
{

cout<<"Wellcome To VU Money changer";
cout<<"\n";

// data type initillizing

char con,coninto,op;
float amount;
do
{

//discription print message on consol what program contains

cout<<"Please select currencies that you want to Exchange
:"<<endl;
cout<<"\n"<<"Discription:"<<endl;
cout<<"\n";
cout<<"\t"<<":***********************************************:"<<
endl;
cout<<"\t"<<": Press 'R' & hit Enter For Pakistani Rupees
:"<<endl;
cout<<"\t"<<": Press 'E' & hit Enter For British Euro    :"<<endl;
cout<<"\t"<<": Press 'D' & hit Enter For United Stats Doller
:"<<endl;
cout<<"\t"<<":***********************************************:"<<
endl;
cout<<"\n";
/* Here consol prompt the user to enter name of currency that
He/She
wants to change. And con stands for converting value */

cout<<": Please Enter curuncy that you want to change :";
cin>>con;
cout<<"\n";

/* Here consol print a message for user to enter the command to
converting value wich He/She wants. coninto stands for convert
into */

cout<<": Please Enter curuncy that you want to exchange:";
cin>>coninto;
cout<<"\n";

/* Here console will show a message for the user to enter amount
that He/she wants to convert */

cout<<": Please Enter amount that you want to change :";
cin>>amount;
cout<<"\n";

// initilizing float data type

float value,camount;

/* float data type (value) contains the currency rate and float
data type
( camount ) contans the value after calculating and then print
message.
 camount stands for changed amount*/

if ((con=='R' || con=='r') && (coninto=='d' || coninto=='D'))
{

// This section is for converting Pakistani Rupees into US Dollers
value=84;
camount=amount/value;
cout<<"\n";

/* Here amount shows the value that has been got in above
section and
camount shows calculating values. */

cout<<amount<<" Rupees = "<<camount<<" Doller(s)"<<endl;
}
else if ((con=='R' || con=='r') && (coninto=='E' || coninto=='e'))
{

// This section is for converting Pakistani Rupees into Euro

value=112;
camount=amount/value;
cout<<"\n";
cout<<amount<<" Rupees ="<<camount<<" Euro"<<endl;
}
else if ((con=='E' || con=='e') && (coninto=='R' || coninto=='r'))
{

// This section is for converting Euro into Pakistani Rupees

value=112;
camount=value*amount;
cout<<amount<<" Euro ="<<camount<<" Rupees"<<endl;
}
else if ((con=='D' || con=='d') && (coninto=='R' || coninto=='r'))
{

// This section is for converting US Dollers into Pakistani Rupees

value=84;
camount=amount*value;
cout<<amount<<" Doller(s) ="<<camount<<" Rupee(s)"<<endl;
}
else if ((con=='E' || con=='e') && (coninto=='D'|| coninto=='d'))
{

// This section is for converting Euro into US Dollers

value=1.38;
camount=amount*value;
cout<<amount<<" Euro(s) ="<<camount<<" Doller(s)"<<endl;
}
else if ((con=='D' || con=='d') && (coninto=='E' || coninto=='e'))
{

// This section is for converting US Dollers into Euro

value=0.75;
camount=amount*value;
cout<<amount<<" Doller(s) ="<<camount<<" Euro(s)"<<endl;
}
else

// If any mistake occured in currency command consol will shwos
this message

cout<<" Invalid InPut enter correct command"<<endl;
cout<<"\n";

/* This the Do-While loop statment. In this statment if user wants
to convert
more amount press Y the programe will restart if he pressed N
then program will
end */

cout<<"Do You want to convert more [Y/N]: ";
cin>>op;
}
while (op=='Y' || op=='y');

//Ending line. This line executes in turbo c or in cmd.exe
cout<<"\n"<<"Thank you For using VU money changer";
return 0;
getch();
}

				
DOCUMENT INFO
Shared By:
Stats:
views:38
posted:5/12/2010
language:English
pages:5
Description: Assignments solutions ..idea solutions.