Tuesday 18 November 2014

Forex Exchange System Project in C++

Structure of the Problem Requirements 

The Forex exchange system deal with the currency of the different countries and here is the complete code of this system in C++. The Forex exchange system consist of 4 major modules and these are admin,user,signup,and visitors modules. The admin module deal with the currency rates,currency sold and about system information. The user module deal with the customers who already have account on the system and signup module is for new customers to join the system. The visitors module is open for public and they can see the rates and other news about the system.

Note : All the passwords are given in the program.


Source Code 

#include<iostream>
#include<fstream>
#include<windows.h>
#include<iomanip>
#include<string>
#include<cctype>
#include<time.h>
#include<conio.h>
using namespace std;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void initial_Shashka_f(); // functions used in programe
void programe_Options_f();
void Admin_f();
void Admin_Options_f();
void Sign_Up_f();
void Currency_list_f();
void Currency_Buying_Price_f();
void Currency_Saling_Price_f();
void Admin_signIn_f();
void User_SignIn();
void User_f();
void Total_Sold_f();
void user_Options_f();
void Visitor_f();
void wait ( int seconds );
void Return_Exit_f();
void U_Return_Exit_f();
void V_Return_Exit_f();
void Exit();
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Currency Filing Material
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
int cur_counter=0;
string deplacer(string b);
string replacer(string b);
void add_cur();
void update_cur();
void display_cur();
ofstream write;
ifstream reader;

void cur_writer();
struct currency
{
int id;
string name;
float buyCur;
float sellCur;

}cur[15];
void load_cur();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
char choice=0;
float totalProfit=0.0;
double totalSold[10];
float Bill;
int x; //globel variabel;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main()
{
load_cur();
string userList[10]={"userOne","userTwo","userThree","userFour","userFive","userSix","userSeven","userEight","userNine","userTen"};
system("color 40");
initial_Shashka_f();
programe_Options_f();
    cin>>choice;
system("cls");
if (isalpha(tolower(choice)))
{
switch (choice)
{
case 'a':
Admin_f();
break;
case 'b':
User_f();
main();
break;

case 'c':
Sign_Up_f();
main();
break;
case 'd':
Visitor_f();
break;

case 'e':
Exit();
break;

default:
Beep(1000,400);
cout<<"Selection Not Found try again"<<endl;
main();
}
}

else
{
system("cls");
Beep(1000,400);
Beep(1000,400);
if (!isalpha(choice))
{
cout<<"Irrelevent Information"<<endl<<"Input must be in character Form"<<endl;
main();
}
}
return 0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void initial_Shashka_f()
// this function is of void type only contains starting heading file includin the name of  
//  program & return nothing;  
{
cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl<<endl;
cout<<" LEP Forex Exchange System         "<<endl<<endl; //=
cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
cout<<endl<<endl;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void programe_Options_f()
//this function contains void type & returns nothing 
//in this function options for the user/admin/visitor are plased
//through these options one can enter in program.
{
cout<<"\t countinue with following options"<<endl<<endl;
cout<<"Loading";
wait (1);
cout<<".";
wait(1);
cout<<".";
wait(1);
cout<<"."<<endl<<endl;
cout<<"A:: Admin  \t\t\t B::user (Already having an account)\n\nC:Sign_up(New user) \t\t D::visitor "<<endl<<endl;
cout<<"E:: Exit"<<endl;
cout<<endl;
cout<<"selection= ";

}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void wait ( int seconds )
//this function contains void type & returns nothing
//function is used for delay like shoing "Loading......."

{
clock_t endwait;
endwait = clock () + seconds * CLOCKS_PER_SEC ;
while (clock() < endwait) {}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Admin_f() //this function contains void type
//Administrator can only enter in the program through this function
//if wrong statement is given functoin will be recalled after a beep & warning
{
Admin_signIn_f();

}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Admin_Options_f()
//void type function & returns nothing
//function contains options for administrator like change currency prices e.t.c
{
cout<<"A::Check UserList \t\t\t B::check currency List\n\n"<<"C::Change Currency Rates \t\t\t D::Total Profit "<<
"\n\nE::Total Currency Sold \t\t\t F::Information about Programe"<<"\n\nG::Sign out\t\t\t H::Exit Programe"<<endl<<endl;
cout<<"Choice= ";
cin>>choice;

if (isalpha(tolower(choice)))
{
switch(choice)
{
case 'a':
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<" Currency List         "<<endl; //=
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<endl<<endl;
display_cur();
Return_Exit_f();
break;
case 'b':
add_cur();
Return_Exit_f();
break;
case 'c':
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<" Currency rates Change         "<<endl; //=
cout<<"-----------------------------------------------------------------------------"<<endl; //=
update_cur();
cout<<endl<<endl;
//rate change;;;;;;
Return_Exit_f();
break;

case 'd':
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<" Total Profit         "<<endl; //=
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<endl<<endl;
cout<<"totalProfit ="<<totalProfit<<endl;
Return_Exit_f();
break;

case 'e':
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<" Total currency Sold         "<<endl; //=
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<endl<<endl;
Total_Sold_f();
Return_Exit_f();
break;


case 'f':
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<" Information about Program         "<<endl; //=
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<endl<<endl;
// Program_Information_f();
Return_Exit_f();
break;
case 'g':
cout<<"signing out wait";
wait(1); cout<<"."; wait(1); cout<<"."; wait(1); cout<<"."<<endl;
system("cls");
main();


case 'h':
Exit();
break;

default:
Beep(1000,400);
cout<<"Wrong Entry"<<endl;
Admin_Options_f();


}
}
else
{
Beep(1000,400);
cout<<"Irrelevent Input please give input in character form"<<endl;
Return_Exit_f();
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Return_Exit_f()
//void type function & returns nothing
//have option for admin to go to main menu or to exit program.
{
cout<<" Now You have TWO choices"<<endl;
cout<<"Main Menu=   Y     Exit=N"<<endl;
cout<<"choice= ";

cin>>choice;

if (isalpha(tolower(choice)))
{
switch(choice)
{
case 'y':
system("cls");
initial_Shashka_f();
Admin_Options_f();
break;

case 'n':
Exit();
break;
default:
Beep(1000,400);
cout<<"Wrong entry"<<endl<<endl;
Return_Exit_f();
}
}

else
{
Beep(1000,400);
Beep(1000,400);
cout<<"Irrelevent Input please give input in Character form"<<endl;
Return_Exit_f();
}

}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Exit()
//void type function & returns nothing
//function is used to terminate programe after showing safe options
{
system("cls");
cout<<endl<<endl<<endl;
wait(1);
cout<<"\t\t\t\t------------------- "<<endl;
wait(2);
cout<<"\t\t*** wait while system is switching OFF ***"<<endl;
wait(1);
cout<<"\t\t\t safe to switch of now"<<endl;
wait(2);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Sign_Up_f()                
//Sign up function contains void type and returns nothing
//new user has given option through this function to creat his/her account to buy currency
{                                                                                                                                                                                                                                        //
                                      //signUp                                                                                                                                                                                           //  
                                      char x;                                                                                                                                                                                            //
   string First_Name;                                                                                                                                                                                     //
   string Last_Name;                                                                                                                                                                                      //
   string user_Name;                                                                                                                                                                                      //
   string U_Password;                                                                                                                                                                                     //
   string U2_Password;                                                                                                                                                                                    //
   cout<<"enter First Name ending with '.'=";                                                                                                                                                                              //
   getline(cin,First_Name,'.');                                                                                                                                                                                        //
   cout<<"enter Last Name ending with '.'=";                                                                                                                                                                               //
   getline(cin,Last_Name,'.');                                                                                                                                                                                         //
   cout<<"enter Username ending with '.'=";                                                                                                                                                                                //
   getline(cin,user_Name,'.');                                                                                                                                                                                       //
   do                                                                                                                                                                                                      //
   {                                                                                                                                                                                                       //
      cout<<"enter Password (only in integers)=";                                                                                                                                                                 //
      cin>>U_Password;      
                                                                                                                                                                                                                                              //
                                                                                                                                                                                                                                    //
      cout<<"Re_Enter Password (only in integers)=";                                                                                                                                                              //
      cin>>U2_Password;                                                                                                                                                                        //
     
 if (U_Password!=U2_Password)                                                                                                                                                             //
 {  Beep(1000,400);                                                                                                                                                                                      //
         cout<<"Password Doesn't Match Please try again"<<endl;                                                                                                       //
         cout<<"Do you want to try again?/n/n"<<"yess=Y             No='N'\n if you say 'no' then system will terminate";                                                                                                            //
         cin>>x;                                                                                                                                          //
      }                                                                                                                                                            //
      else                                                                                                                                                        //
      {                                                                                                                                                        //
         if (U_Password==U2_Password)                                                                                                                     //
         {  x='n'; 
            cout<<"Thanks For Registration "<<endl;
cout<<"\n\n Do you want to move to main menu? "<<endl;
cout<<"yess=Y                             Exit=N"<<endl;
cout<<"choice =";
if (isalpha(tolower(choice)))
{
switch(choice)
{
case 'y':
User_f();
break;
case 'n':
Exit();
break;
default:
Beep(1000,400);
cout<<"Wrong entry"<<endl<<endl;
Return_Exit_f();
}
}
else
{
Beep(1000,400);
Beep(1000,400);
cout<<"Irrelevent Input please give input in character form"<<endl;
Return_Exit_f();
}
                                                                                                                                                                                                                                 //
                                                                                                                                                                                                                                         //
     }                                                                                                                                             //
 }                                                                                                                         //
}                                                                                                                                                                                                                                   //
      while (x=='y');                                                                                                                                                                          //
                                                                                                                                                                                                                       //

   }                                                                                                                                                                                                                                                                                                              //

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Currency_list_f() //currency lis function is a void type  function & returns nothing
//function used to show the list of the available currencies in stock
{

string currencyList[]={"USD","Saudi Rayal","Dirham","Indian Rupee","YENN","EURO","POUND","CANADIAN DOLLER","Yuan","Bangladeshi Takka"};
for (int i=0;i<10;i++)
{
cout<<"\t"<<currencyList[i]<<endl;
}
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Currency_Buying_Price_f()
//currency Buying Price function have void type & returns nothing
//function used to show the list of currency Buying Rates list of available stock
{
string currencyList[]={"USD","Saudi Rayal","Dirham","Indian Rupee","YENN","EURO","POUND","CANADIAN DOLLER""Yuan","Bangladeshi Takka"};
string currencyBuyingRates[]={"92.98","22.0","25.26","1.82","45","80","142.5","110","45.6","0.57"};
for(int j=0;j<10;j++)
{
cout<<j+1<<currencyList[j]<<" = "<<currencyBuyingRates[j]<<endl;
}
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Currency_Saling_Price_f()
//currency Saling Price function have void type & returns nothing
//function used to show the list of currency Saling Rates list of available stock
{
string currencyList[]={"USD","Saudi Rayal","Dirham","Indian Rupee","YENN","EURO","POUND","CANADIAN DOLLER""Yuan","Bangladeshi Takka"};
string currencySalingRates[]={"93.98","23.5","27","1.98","46","81.30","143.8","111.2","46.70","0.68"};
for(int k=0;k<10;k++)
{
cout<<k+1<<currencyList[k]<<" = "<<currencySalingRates[k]<<endl;
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void User_SignIn()
{
    
string PIN[10]={"1234","1122","1123","7222","1111","23462","6666","6600","0071","9022"};
    string U_Password;
initial_Shashka_f();
cout<<"\tPassword= ";
cin>>U_Password;

for(int i=0;i<10;i++)
{
if (PIN[i]!=U_Password)
{
system ("cls");
cout<<"\t\t Error Try again:";
User_SignIn();
}
else
{
if(PIN[i]==U_Password)
{
cout<<"\t\tWelcome User\n\n";
user_Options_f();
}
}
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Admin_signIn_f()
{
string AdminPassword="2798";
string  A_Password;
initial_Shashka_f();
cout<<endl;
cout<<"Admin Password only integer values =";
cin>>A_Password;
    if(A_Password!=AdminPassword)
{
system("cls");
Beep(1000,400);
cout<<"ERROR..............."<<endl<<"check username or password"<<endl;
Admin_signIn_f();

}


else
{
if(A_Password==AdminPassword)
{
system("cls");
Admin_Options_f();
}
}


}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void User_f()
{
User_SignIn();
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void user_Options_f()
{
float Amount;
    float convertedAmount=0.0;
float Profit=0.0;

float T_Profit=0.0;
string currencyList[]={"USD","Saudi Rayal","Dirham","Indian Rupee","YENN","EURO","POUND","CANADIAN DOLLER""Yuan","Bangladeshi Takka"};
double currencySalingRates[10]={93.98,23.5,27,1.98,46,81.30,143.8,111.2,45.60,0.57};
double currencyBuyingRates[10]={92.98,22.0,25.26,1.82,45,80,142.5,110,46.70,0.68};
if(x=1)
{
initial_Shashka_f();
cout<<"\tcountinue with Following"<<endl<<endl;
cout<<"A::Currency List \t\t\t B::Currency Buying Rates"<<endl;
cout<<"C::Currency Saling Rates \t\t D::Buy Currency"<<endl;
cout<<"E:: Convert Currency In PKR"<<endl;
cout<<"F::Programe Information \t\t G::Signout"<<endl;
cout<<"H::Exit"<<endl;
cout<<"choice";

cin>>choice;

if (isalpha(tolower(choice)))
{
switch(choice)
{
case 'a':
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<" Currency List         "<<endl; //=
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<endl<<endl;
Currency_list_f();
U_Return_Exit_f();
break;

case 'b':
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<" Currency Buying rates         "<<endl; //=
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<endl<<endl;
Currency_Buying_Price_f();
U_Return_Exit_f();
break;

case 'c':
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<" Currency saling rates         "<<endl; //=
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<endl<<endl;
Currency_Saling_Price_f();
U_Return_Exit_f();
break;

case 'd':
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<" Buy Currency         "<<endl; //=
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<endl<<endl;
cout<<"Select currency you want to buy"<<endl;
Currency_list_f();
cin>>choice;
cout<<"\n\t Enter Amount =";
cin>>Amount;

Bill=currencySalingRates[choice-1]*Amount;
cout<<"Bill = "<<Bill<<endl;

Profit=currencySalingRates[choice-1]-currencyBuyingRates[choice-1];
T_Profit=Profit*Amount;
totalProfit=T_Profit+totalProfit;
totalSold[choice-1]=Amount+totalSold[choice-1];

U_Return_Exit_f();
break;

case 'e':
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<" Currency Converter         "<<endl; //=
cout<<"-----------------------------------------------------------------------------"<<endl; //=
cout<<endl<<endl;
cout<<"Select currency you want to buy"<<endl;
Currency_list_f();
cin>>choice;
cout<<"\n\t Enter Amount =";
cin>>Amount;
convertedAmount=currencySalingRates[choice-1]*Amount;
system("cls");
cout<<"\n\n\t Amount In PKR ="<<convertedAmount<<endl;
U_Return_Exit_f();
break;


case 'f':
initial_Shashka_f();
cout<<"\tin this programe .................................."<<endl;
U_Return_Exit_f();
break;

case 'g':
cout<<"signing out wait";
wait(1); cout<<"."; wait(1); cout<<"."; wait(1); cout<<"."<<endl;
system("cls");
main();
break;

case 'h':
Exit();
break;

default:
Beep(1000,400);
cout<<"Wrong input please try Again"<<endl;
user_Options_f();

}
}
else
{

system("cls");
Beep(1000,400);
Beep(1000,400);
cout<<"input must in character form "<<endl;
user_Options_f();

}
}
else
{
if(x==2)
{
Beep(1000,400);
cout<<"please try Again"<<endl;
User_f();
}
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Total_Sold_f()
{
for(int m=0;m<10;m++)
cout<<m+1<<" ="<<totalSold[m]<<endl;
    }
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void U_Return_Exit_f()
{
cout<<" Now You have TWO choices"<<endl;
cout<<"Main Menu=   Y     Exit=N"<<endl;
cout<<"choice= ";

cin>>choice;

if (isalpha(tolower(choice)))
{
switch(choice)
{
case 'y':
system("cls");
initial_Shashka_f();
initial_Shashka_f();
user_Options_f();
break;

case 'n':
Exit();
break;
default:
Beep(1000,400);
cout<<"Wrong entry"<<endl<<endl;
U_Return_Exit_f();
}
}

else
{
Beep(1000,400);
Beep(1000,400);
cout<<"Irrelevent Input please give input in character form"<<endl;
U_Return_Exit_f();
}

}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Visitor_f()
{
initial_Shashka_f();
cout<<"\tWelcome Visitor"<<endl<<endl;
cout<<"proceed By following options"<<endl<<endl;
cout<<"A::Currency List"<<endl;
cout<<"B::Currency Buying Rates"<<endl;
cout<<"C::Currency Saling Rates"<<endl;
cout<<"E::Exit"<<endl;
cin>>choice;

if(isalpha(tolower(choice)))
{
system("cls");
switch (choice)
{
case 'a':
Currency_list_f();
V_Return_Exit_f();
break;

case 'b':
Currency_Buying_Price_f();
V_Return_Exit_f();
break;

case 'c':
Currency_Saling_Price_f();
V_Return_Exit_f();
break;

case 'e':
Exit();
break;
default:
Beep(1000,400);
cout<<"Wrong Input Try Again"<<endl;
Visitor_f();
}
}
else
if(!isalpha(choice))
{
system("cls");
Beep(1000,400);

Beep(1000,400);
cout<<"Irrelevent Information"<<endl;
cout<<"input must be in Character form"<<endl;
Visitor_f();

}
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void V_Return_Exit_f()
{
cout<<" Now You have TWO choices"<<endl;
cout<<"Main Menu=   Y     Exit=N"<<endl;
cout<<"choice= ";

cin>>choice;

if (isalpha(tolower(choice)))
{
switch(choice)
{
case 'y':
system("cls");
Visitor_f();
break;

case 'n':
Exit();
break;
default:
system("cls");
Beep(1000,400);

cout<<"Wrong entry"<<endl<<endl;
V_Return_Exit_f();
}
}

else
{
Beep(1000,400);
cout<<"Irrelevent Input please give input in character form"<<endl;
V_Return_Exit_f();
}


}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void add_cur()
{
string currency;
write.open("currency.txt",ios::app);
if(!write.good())
{
write.open("currency.txt",ios::out);
}




system("cls");

cur_counter++;
cur[cur_counter].id= cur_counter;
write<<endl<<cur[cur_counter].id;
cout<<"Enter currency name";
getline(cin,cur[cur_counter].name,'*');
write<<replacer(cur[cur_counter].name)<<endl;
cout<<"Enter Your buying price";
cin>>cur[cur_counter].buyCur;
write<<cur[cur_counter].buyCur<<endl;
cout<<"Enter Your selling price";
cin>>cur[cur_counter].sellCur;
write<<cur[cur_counter].sellCur<<endl;

write.close();
cout<<"Press enter to select again";
getche();
}


//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void update_cur()
{
char choice=0;
float  amount=0;
int cur_id=0;
cout<<"Enter the  ID";
cin>>cur_id;
if(cur[cur_id].id>0 && cur[cur_id].id<15)
{
string tem_cur_name;
cout<<"Currency Name :"<<cur[cur_id].name.substr(1,cur[cur_id].name.length())<<endl;
cout<<"Currency Buying Price :"<<cur[cur_id].buyCur<<endl;
cout<<"Currency Selling Price :"<<cur[cur_id].sellCur<<endl;
cout<<"<A> to Change name\n";
cout<<"<B> to Change Buying Rate\n";
cout<<"<C> to Change Selling Rate\n";
cin>>choice;
if(tolower(choice=='a'))
{
cout<<"Enter New Name of the user:";
getline(cin,tem_cur_name,'*');
cur[cur_id].name=tem_cur_name;
cout<<"Update";
cur_writer();
}
else if(tolower(choice=='b'))
{
cout<<"Enter New buying Price of the Currency:";
cin>>amount;
cur[cur_id].buyCur=amount;
cout<<"Update";
cur_writer();
}
else if(tolower(choice=='b'))
{
cout<<"Enter New selling price of the user:";
cin>>amount;
cur[cur_id].sellCur=amount;
cout<<"Update";
cur_writer();
}
else
{
cout<<"invalid attempt"<<endl;
update_cur();
}
}
else
{
cout<<"\n Record Not found";
}

cout<<"Press enter to select again";
getche();


}



//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void display_cur()
{
cout<<"ID\t\tName\t\tbuyingPrice\tSelling Price\n";

for(int i=1;i<=cur_counter;i++)
{
     if(cur[i].name.length()>0)
{
cout<<i<<"\t\t";
cout<<cur[i].name.substr(1,cur[i].name.length())<<"\t\t";
cout<<cur[i].buyCur<<"\t\t";
cout<<cur[i].sellCur<<"\n";
cout<<"\n---------------------------------------------------------\n" ;
}
}


cout<<"Press enter to select again";
getche();

}


//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void load_cur()
{
cur_counter=0;
reader.open("currency.txt");
if(!reader.good())
{
 cout<<"File Not Found";
//  getche();
}else
{
char ch;
reader.get(ch);
while(!reader.eof())
{
reader>>cur_counter;
cur[cur_counter].id= cur_counter;
string name;
reader>>name;
cur[cur_counter].name =" "+deplacer(name);
reader>>cur[cur_counter].buyCur;
//cur[cur_counter].buyCur= " "+deplacer(cur[cur_counter].buyCur);
reader>>cur[cur_counter].sellCur;
//cur[cur_counter].sellCur= " "+deplacer(cur[cur_counter].sellCur);
}
reader.close();
}

}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void cur_writer()
{
if(cur_counter>0)
{
write.open("currency.txt",ios::out);
for(int i=1; i<= cur_counter;i++)
{
if(cur[i].id>0 && cur[i].id<15)
{
write<<endl<<i;
write<<endl<<replacer(cur[i].name);
write<<endl<<cur[i].buyCur;
write<<endl<<cur[i].sellCur;

}
}
write.close();
}


}


//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string replacer(string a)
{
     int i=0;
     do
     {
         i=a.find(" ");
         if(i==0)
         {
                a.replace(i,1,"");                 
         }
         else if(i!=string::npos)
         {
                a.replace(i,1,"*");
         }
         
     }
     while(i!=string::npos);
     return a;
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string deplacer(string b)
{
      int i=0;
     do
     {
         i=b.find("*");
         if(i!=string::npos)
         {
                b.replace(i,1," ");
         }
     }
     while(i!=string::npos);
     return b;
}


//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Output of the Program

Forex Exchange System Project in C++
Forex Exchange System Project in C++
Forex Exchange System Project in C++
Forex Exchange System Project in C++
Forex Exchange System Project in C++
Forex Exchange System Project in C++

Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment