Click here to Skip to main content
15,913,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMFC CDateTimeCtrl and week numbers Pin
LucanFahr18-May-05 3:33
LucanFahr18-May-05 3:33 
GeneralRe: MFC CDateTimeCtrl and week numbers Pin
David Crow18-May-05 4:27
David Crow18-May-05 4:27 
GeneralRe: MFC CDateTimeCtrl and week numbers Pin
LucanFahr24-May-05 21:41
LucanFahr24-May-05 21:41 
Questionhelp: why a control created in VC can not work well in vb? Pin
ictory18-May-05 3:19
ictory18-May-05 3:19 
AnswerRe: help: why a control created in VC can not work well in vb? Pin
toxcct18-May-05 3:25
toxcct18-May-05 3:25 
GeneralRe: C++ Pin
David Crow18-May-05 2:08
David Crow18-May-05 2:08 
GeneralRe: C++ Pin
Anonymous18-May-05 3:29
Anonymous18-May-05 3:29 
GeneralI ve done the project for you! Pin
Anonymous18-May-05 3:31
Anonymous18-May-05 3:31 
This is the proJect
<br />
//Read Plants & Customers, Create Orders, Modify Information, Provide Reports<br />
<br />
#include <iostream.h><br />
#include <string.h><br />
#include <stdio.h><br />
#include <math.h><br />
<br />
const int MaxNoOfPlants=100;     //Maximum Number Of Plants To Be In The List<br />
const int MaxNoOfCustomers=20;   //Maximum Number Of Customers To Be In The list<br />
int menu=0;                     //Menu Choice<br />
int NoOfPlants=0;               //Counts The Number Of Plants Are In The Database<br />
int NoOfCustomers=0;            //Counts The Number Of Customers Are In The Database<br />
int counterP=0;                //Counts How Many Plants Can Still Be Insert In The List <br />
int counterC=0;                //Counts How Many Customers Can Still Be Insert In The List <br />
int FindCustomerList=0;        //The Place In The Array That A Plant Is<br />
int FindPlantList=0;          //The Place In The Array That A Customer Is<br />
<br />
<br />
<br />
class Order1 {      //Part Of class Customer<br />
public:             //Keep Information About The Order That Each Customer Make<br />
                     <br />
  char Order[40];   //Family & Name Of The Ordered Plant<br />
	int Quantity;   //The Ordered Quantity For This Plant<br />
	float Invoice;  //The Cost Of This Plant (Price * Quantity)<br />
};<br />
<br />
<br />
class Plant {                   //Keep Information For Each Plant In Thr List  <br />
public:<br />
	char PlantFamily_Name[40];  //Family & Name Of The Plant<br />
<br />
	char Type[8];               //Flower or Tree<br />
	char Colour[10];            //Colour Of Plant's Blossom<br />
	char Size[8];              //small, medium, large<br />
	int NumOfThisInStock;      //How Many Of This Plant <br />
	char ItIsGarden[3];        //The Answer If Plant Is A Garder Flower<br />
	float Price;               //It's Price<br />
	int QSell;                 //Keep The Number Quantity Sell Of Each Plant<br />
	<br />
	char QName[40];            //In Order To Find The 5 Top Selling Plants<br />
                               //Use This Instead Of "char PlantFamily_Name[40];"<br />
	                           //So We Do Not Lose The Alphabetical Order<br />
    <br />
};<br />
<br />
class Customer {                //Keep Information Of The Customer<br />
public:<br />
	char Name[30];              //Customer's Name<br />
	char Address[80];           //His/Her Address<br />
	char Phone[10];             //Phone Number<br />
	char SocialSecurityNum[15]; //His/Her Sicial Security Number<br />
	int HowM;                   //Keep The Number Of Different Plant He/She Ordered<br />
	float TotalInvoice;         //The Total Cost For Each Order<br />
	float TurnOver;             //The Turnover Of All Orders<br />
	<br />
    Order1 Or[10];<br />
<br />
<br />
};<br />
<br />
<br />
Plant PDBase[MaxNoOfPlants];<br />
Customer CDBase[MaxNoOfCustomers];<br />
<br />
//Displays The Main Menu<br />
void ShowMenu ();<br />
<br />
//Asks For A Choice<br />
void ChooseMenu (int menu);<br />
<br />
//The User Enter Information For A New Plant.<br />
//The Plant Are Sorted According To Alphabetical Order.<br />
void ReadNewPlant ();<br />
<br />
//The User Enter Information For A New Customer.<br />
//The Customers Are Sorted According To Alphabetical Order.<br />
void ReadNewCustomer ();<br />
<br />
//Displays The Plants Are In The List In Alphabetical Order.<br />
//Counts How Many Plants Are In The List And How Many Can Still Be Insert<br />
void HowManyPlants ();<br />
<br />
//Display Plants<br />
void DisplayPlants ();<br />
<br />
//Display Customers<br />
void DisplayCustomers ();<br />
<br />
//Displays The Customers Are In The List In Alphabetical Order.<br />
//Counts How Many Customers Are In The List And How Many Can Still Be Insert<br />
void HowManyCustomers ();<br />
<br />
//Asks For Customers Social Security Number<br />
//Find The Place In The Array That This Customer Is.<br />
void FindCustomer();<br />
<br />
//Find The Customer With The Function "FindCustomer();".<br />
//And Madify Some Of His/Her Information<br />
void ModifyCustomer ();<br />
<br />
//Asks For Plants Family And Name.<br />
//Find The Place In The Array That This Plant Is.<br />
void FindPlant ();<br />
<br />
//Find The Plant With The Function "FindPlant ();".<br />
//And Madify Some Of Its Information<br />
void ModifyPlant ();<br />
<br />
//Delete Customer By Giving His/Her Social Security Number.<br />
void DeleteC ();<br />
<br />
//Delete Plant Giving Its Family And Name <br />
void DeleteP ();<br />
<br />
//Find The Customer That Make This Order....use "FindCustomer();".<br />
//And Enter How Many Different Plants He/She Is Going To Order.<br />
void InsertOrder ();<br />
<br />
//Make This Order. Enter The Plants And The Quantity For Each Different Plants <br />
void MakeOrder ();<br />
<br />
//Show Order That Made By A Customer <br />
void ShowOrder ();<br />
<br />
//Make Changes In The Last Order That Made By A Customer, Or Make A New One <br />
void ModifyOrder ();<br />
<br />
//View An Order<br />
void ViewOrder ();<br />
<br />
//Report Menu. Make A Choice<br />
void ReportChoose ();<br />
<br />
//Find The Customer With The Bigger Turnover<br />
void FindCustBiggerTurnover ();<br />
<br />
//Find The Plants Whose Price Is Between x and y pounds <br />
void FindPlantWhosePriceIs ();<br />
<br />
//Find And Display Out The Top 5 Selling Plants<br />
void TopSell ();<br />
<br />
//Find The Top 5 Selling Plants<br />
void TopSell5 ();<br />
<br />
//Displays The Top 5 Selling Plants<br />
void TopSell5Display ();<br />
<br />
//Find And Displays Top 1 Selling Plant<br />
void TopSell1 ();<br />
<br />
<br />
<br />
//Find And Displays Top 1 Selling Plant<br />
//Compare Using Quantities. Sort The Plants According The Value Of The Quantities<br />
 <br />
void TopSell1 ()<br />
{   <br />
	int i,j;<br />
	char tempName[40]; //Use To Swap The Family & Name Of Plant<br />
	int tempQSell;      //Use To Swap The Qauntity Sell Of Each Plant<br />
<br />
for(i=0; i<NoOfPlants; i++)   //Loop: equal time each is the number of plants are in the list<br />
{<br />
	for(j=0; j<NoOfPlants; j++)  //Loop: equal time each is the number of plants are in the list<br />
	{<br />
<br />
		 if (PDBase[i].QSell>PDBase[j].QSell) //Compare The Quantities Sold For Each Plants<br />
<br />
		 {<br />
<br />
			 strcpy(tempName, PDBase[i].QName);  <br />
			 tempQSell=PDBase[i].QSell;<br />
<br />
			 strcpy(PDBase[i].QName, PDBase[j].QName);<br />
             PDBase[i].QSell=PDBase[j].QSell;<br />
<br />
             strcpy(PDBase[j].QName, tempName);<br />
             PDBase[j].QSell=tempQSell;<br />
		 }<br />
	}<br />
}<br />
//Displays Out Only The Top Selling. That Plant That Was Sold More Than The Others<br />
    cout<<"The Top Selling Plant Is: \n";<br />
   for(i=0; i<1; i++)<br />
   {<br />
	cout<<"\nPLANT'S NAME: "<<PDBase[i].QName<<endl;<br />
	cout<<"SELL QUANTITY : "<<PDBase[i].QSell<<endl;<br />
    cout<<"______________________________\n";<br />
   }<br />
<br />
}<br />
<br />
//This Function is called From Function "TopSell5 ();".<br />
// Display The Top 5 Selling Plants<br />
void TopSell5Display ()<br />
{<br />
	int i;<br />
<br />
    for(i=0; i<5; i++)<br />
	{<br />
     cout<<"______________________________\n";<br />
     cout<<"PLANT #: "<<i+1<<endl;<br />
     cout<<"PLANT'S NAME  : "<<PDBase[i].QName<<endl;<br />
     cout<<"SELL QUANTITY : "<<PDBase[i].QSell<<endl;<br />
     cout<<"______________________________\n";<br />
<br />
<br />
	}<br />
<br />
}<br />
<br />
<br />
//Sort Plants Accorting The Quantities Sold<br />
//Call Function "TopSell5Display ();"<br />
void TopSell5 ()<br />
{   <br />
	int i,j;<br />
	char tempName[40];<br />
	int tempQSell;<br />
<br />
for(i=0; i<NoOfPlants; i++)<br />
{<br />
	for(j=0; j<NoOfPlants; j++)<br />
	{<br />
<br />
 		 if (PDBase[i].QSell>PDBase[j].QSell) //Compare Quantities Sold For Each Plant<br />
<br />
		 {<br />
			 strcpy(tempName, PDBase[i].QName);<br />
			 tempQSell=PDBase[i].QSell;<br />
<br />
			 strcpy(PDBase[i].QName, PDBase[j].QName);<br />
             PDBase[i].QSell=PDBase[j].QSell;<br />
<br />
             strcpy(PDBase[j].QName, tempName);<br />
             PDBase[j].QSell=tempQSell;<br />
		 }<br />
	}<br />
}<br />
<br />
cout<<"The 5 Top Selling Plants Are: \n";<br />
TopSell5Display (); //Call This Fuction To Displays The Top 5 Selling<br />
<br />
}<br />
<br />
<br />
//Copy The Name Of Plants In An Other Array<br />
//This Is Beacause The Plants Are Going To Sort Accorting There Quantities Sold<br />
//So The Alphabetical Order Stay Whithout Any Changes<br />
void TopSell ()<br />
{<br />
	int i;<br />
<br />
	for(i=0; i<NoOfPlants; i++)<br />
	{<br />
		strcpy(PDBase[i].QName, PDBase[i].PlantFamily_Name);<br />
	}<br />
TopSell5 ();<br />
<br />
}<br />
<br />
//Find And Displays Out The Plants Whose Price Is Between x and y pounds<br />
void FindPlantWhosePriceIs ()<br />
{<br />
<br />
	int i;<br />
float Price1;  //From x price<br />
float Price2;  //Up To y price<br />
<br />
cout<<"Please Enter From What Price: \n";<br />
cin>>Price1;<br />
cout<<"And Up To What Price: \n";<br />
cin>>Price2;<br />
<br />
cout<<"\n**PLANTS WHOSE PRICE IS BETWEEN "<<Price1<< " & "<<Price2<<"**\n";<br />
<br />
  for(i=0; i<NoOfPlants; i++)<br />
  { <br />
	if((PDBase[i].Price>=Price1)&&(PDBase[i].Price<=Price2)) //Price Between x And y<br />
	{<br />
    	cout<<"\nPLANT #: "<<i+1<<endl;<br />
	    cout<<"FAMILY & NAME: "<<PDBase[i].PlantFamily_Name<<endl;  //Displays Out The Plants<br />
        cout<<"TYPE         : "<<PDBase[i].Type<<endl;              //With There Informations<br />
	    cout<<"COLOUR       : "<<PDBase[i].Colour<<endl;<br />
	    cout<<"SIZE         : "<<PDBase[i].Size<<endl;<br />
	    cout<<"IN STOCK     : "<<PDBase[i].NumOfThisInStock<<endl;<br />
	    cout<<"GARDEN PLANT : "<<PDBase[i].ItIsGarden<<endl;<br />
	    cout<<"PRICE        : "<<PDBase[i].Price<<endl;<br />
	    cout<<"____________________________\n\n";<br />
	}<br />
  }<br />
}<br />
<br />
<br />
//Find The Customer With The Bigger Turnover<br />
void FindCustBiggerTurnover ()<br />
{<br />
	int i;<br />
	int count=0;<br />
	float FBig=0;<br />
<br />
<br />
	FBig=CDBase[0].TotalInvoice;<br />
	i=1;<br />
<br />
	while(i<NoOfCustomers)<br />
	{<br />
		if(CDBase[i].TurnOver>FBig) //Compare The Turnovers For Each Customer<br />
		{                            //If Is Bigger... <br />
			FBig=CDBase[i].TurnOver;<br />
		count=i; //Is Equal To Place Of The Customer, With The Biggest Turnover, In The Array     <br />
		}<br />
		i++;<br />
	}<br />
<br />
	cout<<"\nCustomer With The Bigger Turnover: \n";        //Display Out The Customer<br />
	cout<<"Customer #: "<<count+1<<endl;                    //With The Turnover<br />
	cout<<"NAME     : "<<CDBase[count].Name<<endl;<br />
	cout<<"TURNOVER :"<<CDBase[count].TurnOver<<endl<<endl;<br />
}<br />
<br />
<br />
//Report Menu. Make A Choice<br />
void ReportChoose ()<br />
{<br />
	int menuR;<br />
<br />
    cout<<"\n\n**REPORT MENU**\n";<br />
	cout<<"____________________\n";<br />
<br />
<br />
	cout<<"\n1.Information Of A Particular Plant\n";<br />
	cout<<"2.Information Of A Particular Customer\n";<br />
	cout<<"3.Information On The Top 5 Selling Plants\n";<br />
	cout<<"4.Information On The Top Selling Plant\n";<br />
	cout<<"5.Information On A Customer With The Biggest Turnover\n";<br />
	cout<<"6.Information On Plants Whose Price Is Between...\n";<br />
	cout<<"7.RETURN TO MAIN MENU\n";<br />
<br />
	cout<<"\nPlease Make Your Choice: "<<endl;<br />
	cin>>menuR;<br />
<br />
<br />
	switch (menuR)  //Choice<br />
	{<br />
<br />
    case 1:  //Displays Out Information On A Particular Plant<br />
		{<br />
			FindPlant ();<br />
	cout<<"\n\nPLANT #: "<<FindPlantList+1<<endl;<br />
	cout<<"FAMILY & NAME: "<<PDBase[FindPlantList].PlantFamily_Name<<endl;<br />
    cout<<"TYPE         : "<<PDBase[FindPlantList].Type<<endl;<br />
	cout<<"COLOUR       : "<<PDBase[FindPlantList].Colour<<endl;<br />
	cout<<"SIZE         : "<<PDBase[FindPlantList].Size<<endl;<br />
	cout<<"IN STOCK     : "<<PDBase[FindPlantList].NumOfThisInStock<<endl;<br />
	cout<<"GARDEN PLANT : "<<PDBase[FindPlantList].ItIsGarden<<endl;<br />
	cout<<"PRICE        : "<<PDBase[FindPlantList].Price<<endl;<br />
	cout<<endl<<endl;<br />
			break;<br />
		}<br />
<br />
	case 2:   //Displays Out The Information Of A Particular Customer<br />
		{<br />
          FindCustomer();<br />
   cout<<"\n\nCUSTOMER #: "<<FindCustomerList+1<<endl;<br />
   cout<<"NAME          : "<<CDBase[FindCustomerList].Name<<endl;<br />
   cout<<"ADDRESS       : "<<CDBase[FindCustomerList].Address<<endl;<br />
   cout<<"PHONE NUMBER  : "<<CDBase[FindCustomerList].Phone<<endl;<br />
   cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
   cout<<endl<<endl;<br />
          break;<br />
		}<br />
<br />
	case 3:    //Finds And Displays Out The Top 5 Selling Plants<br />
		{<br />
         TopSell ();<br />
		 break;<br />
		}<br />
<br />
	case 4:   //Finds And Displays Out The Top Selling Plant<br />
		{<br />
         TopSell1 ();<br />
		 break;<br />
<br />
		}<br />
	case 5:  //Information On A Customer With The Biggest Turnover<br />
		{<br />
         FindCustBiggerTurnover ();<br />
		 break;<br />
<br />
		}<br />
<br />
	case 6:   //Information On Plants Whose Price Is Between Two Prices<br />
<br />
		{<br />
         FindPlantWhosePriceIs ();<br />
		 break;<br />
		}<br />
<br />
<br />
	case 7:   //Return To Main Menu<br />
		{<br />
<br />
         ShowMenu ();<br />
		cout<<"Choose an action: ";<br />
        cin>>menu;<br />
		ChooseMenu(menu);<br />
		break;<br />
<br />
		}<br />
<br />
	default:  //Show Again The Report's Menu<br />
		{<br />
		ReportChoose ();<br />
		break;<br />
<br />
			<br />
		}<br />
	}<br />
}<br />
<br />
<br />
<br />
//View An Order Of A Particular Customer<br />
void ViewOrder ()<br />
{<br />
cout<<"**VIEW ORDER**\n";<br />
cout<<"Find The Customer How Make That Order\n";<br />
FindCustomer();                                   //Find The Customer By Giving His/Her Social Number<br />
cout<<"\n*SELECTED CUSTOMER*\n";<br />
   cout<<"_______________________\n"; <br />
   cout<<"CUSTOMER #: "<<FindCustomerList+1<<endl;        //Display The Information Of This Customer<br />
   cout<<"NAME          : "<<CDBase[FindCustomerList].Name<<endl;<br />
   cout<<"ADDRESS       : "<<CDBase[FindCustomerList].Address<<endl;<br />
   cout<<"PHONE NUMBER  : "<<CDBase[FindCustomerList].Phone<<endl;<br />
   cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
   cout<<endl<<endl;<br />
<br />
cout<<"This Is His/Her Order\n";<br />
cout<<"_________________\n";<br />
ShowOrder ();                //Display The Order<br />
<br />
<br />
}<br />
<br />
//With This Function User Can Motify Orders <br />
void ModifyOrder ()<br />
{<br />
  char q;<br />
  char choice1;<br />
int i;<br />
  float inv=0.0;         //The Invoice For Each Ordered Plant<br />
int plus=0;             //The Number Of The Plants To Be Insert In The Order<br />
float tempInvoice=0.0;  //Keep The Value Of The Old Invoice Of The Old Order<br />
int tempQuantity=0;     //Keep The Old Value Of The Quantity Ordered<br />
<br />
<br />
cout<<"**MODIFY ORDER**\n";<br />
cout<<"Find The Customer How Make That Order\n";<br />
FindCustomer();                                  //Find This Customer With His/Her Social Security Number<br />
cout<<"\n*SELECTED CUSTOMER*\n";<br />
   cout<<"_______________________\n"; <br />
   cout<<"CUSTOMER #: "<<FindCustomerList+1<<endl;<br />
   cout<<"NAME          : "<<CDBase[FindCustomerList].Name<<endl;<br />
   cout<<"ADDRESS       : "<<CDBase[FindCustomerList].Address<<endl;<br />
   cout<<"PHONE NUMBER  : "<<CDBase[FindCustomerList].Phone<<endl;<br />
   cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
   cout<<endl<<endl;<br />
<br />
cout<<"This Is His/Her Order\n";<br />
cout<<"_________________\n";<br />
ShowOrder ();                        //Displays Customer's Order<br />
<br />
cout<<"\nAre You Sure You Want To Modify This Order? (y or n):\n"; //Question 1<br />
cin>>q;                                                         //Ask User If He/She Is Sure To Modify <br />
<br />
if((q=='y')||(q=='Y'))    //If Answer Is Yes<br />
{<br />
<br />
//Enter 1 If Want To Change Only The Quantity Of The Ordered Plants<br />
cout<<"If You Want To Change Only The Quantity Of The Plants Of The Last Order Enter 1.\n";<br />
//Enter 2 If Want To Insert More Differents Plants In The Order <br />
cout<<"If You Want To Insert More Different Plants In Your Order Enter 2.\n";<br />
//Enter 3 If Want To Make A New Order<br />
cout<<"If You Want To Make A New Order For That Customer Enter 3.\n";<br />
  cin>>choice1;  //Question 2<br />
<br />
  if(choice1=='1')  //If Answer Is 1<br />
<br />
  {    tempInvoice=CDBase[FindCustomerList].TotalInvoice;<br />
        <br />
       cout<<"*Change The Quantity*\n";<br />
	   cout<<"\nCUSTOMER'S NAME: "<<CDBase[FindCustomerList].Name<<endl;<br />
       for(i=0; i<CDBase[FindCustomerList].HowM; i++)<br />
	   {<br />
<br />
 	   cout<<"PLANT # : "<<i+1<<endl;<br />
	   cout<<"Name:   : "<<CDBase[FindCustomerList].Or[i].Order<<endl;<br />
	   cout<<"In Order To Continue\n";<br />
       FindPlant ();                                                //Enter Again Family & Name Of This Plant <br />
	   tempQuantity=PDBase[FindPlantList].QSell;    //Keep The Old Value Of The Quantity Ordered<br />
	   cout<<"New Quantity: "<<endl;                //Asks For The New Quantity<br />
   	   cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
<br />
	    if(PDBase[FindPlantList].NumOfThisInStock==0)  //If There Are No Any Plants Of This Type In The Database<br />
		{                                              //A Message Displays That<br />
		  cout<<"There Are No Such Plants In Stock\n";<br />
   <br />
		}<br />
		//If The New Quantity Is Bigger Than The Quantity Of This Plant In Stock<br />
	    if(CDBase[FindCustomerList].Or[i].Quantity>PDBase[FindPlantList].NumOfThisInStock)<br />
		{<br />
		//The Order Stops<br />
		 cout<<"Order Stoped\n";<br />
		 //Show The Number Of This Plant In Stock<br />
		 cout<<"Available Quantity For This Is: "<<PDBase[FindPlantList].NumOfThisInStock<<endl;<br />
		 cout<<"\nPlease Change Quantity. New Quantity: \n";  //Ask For A New Quantity<br />
         cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
		}<br />
		//The Number Of This Plant In Stock Is Updated.<br />
		PDBase[FindPlantList].NumOfThisInStock=PDBase[FindPlantList].NumOfThisInStock-CDBase[FindCustomerList].Or[i].Quantity;<br />
		//Calculate The Invoice For Each Different Plant<br />
         CDBase[FindCustomerList].Or[i].Invoice=CDBase[FindCustomerList].Or[i].Quantity*PDBase[FindPlantList].Price;<br />
		 //Total Invoice<br />
	     inv=inv+CDBase[FindCustomerList].Or[i].Invoice;<br />
	     CDBase[FindCustomerList].TotalInvoice=inv;<br />
		 //Quantity Sold For Each Plant Is Updated<br />
		 PDBase[FindPlantList].QSell=PDBase[FindPlantList].QSell+CDBase[FindCustomerList].Or[i].Quantity-tempQuantity;<br />
		 //Total Turnover<br />
		 CDBase[FindCustomerList].TurnOver=CDBase[FindCustomerList].TurnOver+CDBase[FindCustomerList].TotalInvoice-tempInvoice;<br />
	   }<br />
  <br />
         <br />
	   <br />
  }<br />
   //Question 2<br />
  if(choice1=='2') //If Answer Is 2...Insert More Different Plants In The Order<br />
  {<br />
    cout<<"*Insert More*\n";<br />
	cout<<"\nCUSTOMER'S NAME: "<<CDBase[FindCustomerList].Name<<endl;<br />
<br />
	//Ask The Number Of Different Plants To Insert<br />
	cout<<"\nHow Many Different Plants Do You Want To Insert To Your Order?: \n";<br />
	cin>>plus;   <br />
<br />
	for(i=CDBase[FindCustomerList].HowM; i<CDBase[FindCustomerList].HowM+plus; i++)<br />
	{<br />
		<br />
     cout<<"PLANT #: "<<i+1<<endl;        //Insert The First New Plant<br />
     FindPlant ();                 //Find That Plant <br />
	 cout<<"SELECTED PLANT: "<<PDBase[FindPlantList].PlantFamily_Name <<endl;<br />
     cout<<"Quantity: "<<endl;             //Insert The Quantity Customer Want<br />
	 cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
    <br />
     if(PDBase[FindPlantList].NumOfThisInStock<=0)   //If The Quantity Of This Plant In Stock Is Zero<br />
	 {<br />
		 cout<<"There Are No Such Plants In Stock\n";   //Asks User To Change The Order By Selecting An Other Plant<br />
		 cout<<"Please Change Your Order.\n";<br />
		 cout<<"PLANT #: "<<i+1<<endl;<br />
         FindPlant ();                  //Find New Plant<br />
	     cout<<"SELECTED PLANT: "<<PDBase[FindPlantList].PlantFamily_Name <<endl;<br />
         cout<<"Quantity: \n";            //Quantity<br />
         cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
		 <br />
	 }<br />
        //If The New Quantity Is Bigger Than The Quantity Of This Plant In Stock<br />
	  if(CDBase[FindCustomerList].Or[i].Quantity>PDBase[FindPlantList].NumOfThisInStock)<br />
	 {<br />
		//The Order Stop And Show How MAny Plant Of This Type Are Available<br />
		 cout<<"Order Stoped\n";<br />
		 cout<<"Available Quantity For This Is: "<<PDBase[FindPlantList].NumOfThisInStock<<endl;<br />
	     //Ask User For New Quantity<br />
		 cout<<"\nPlease Change Quantity. New Quantity: \n";<br />
         cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
	<br />
	  }<br />
	 //Take The Order...Name Of Ordered Plant<br />
	  strcpy(CDBase[FindCustomerList].Or[i].Order, PDBase[FindPlantList].PlantFamily_Name);<br />
	  //Stock Number Updated<br />
	  PDBase[FindPlantList].NumOfThisInStock=PDBase[FindPlantList].NumOfThisInStock-CDBase[FindCustomerList].Or[i].Quantity;<br />
	  //Invoice For Each Ordered Plant <br />
      CDBase[FindCustomerList].Or[i].Invoice=CDBase[FindCustomerList].Or[i].Quantity*PDBase[FindPlantList].Price;<br />
	  //Quantity Solt For Each Plant Is Updated<br />
	  PDBase[FindPlantList].QSell=PDBase[FindPlantList].QSell+CDBase[FindCustomerList].Or[i].Quantity;<br />
	  inv=inv+CDBase[FindCustomerList].Or[i].Invoice;<br />
      <br />
	  cout<<"Continue.\n";<br />
	 <br />
	 }<br />
	//Number Of Different Plants Ordered From This Customer is Updated<br />
     CDBase[FindCustomerList].HowM=CDBase[FindCustomerList].HowM+plus;<br />
   //Total Invoice Is Updated<br />
	CDBase[FindCustomerList].TotalInvoice=CDBase[FindCustomerList].TotalInvoice+inv;<br />
	//Turnover IS updated<br />
	CDBase[FindCustomerList].TurnOver=CDBase[FindCustomerList].TurnOver+CDBase[FindCustomerList].TotalInvoice;<br />
  }<br />
  //Question 2<br />
  if(choice1=='3') //If choice is 3<br />
  {<br />
    //Make A New Order<br />
	  cout<<"*MAKE NEW ORDER*\n";<br />
	  //Ask How Many Different Plant Is Going To Order<br />
	cout<<"Please Enter How Many Different Plants You Are Going To Order: \n";<br />
	cin>>CDBase[FindCustomerList].HowM;<br />
	//Make The New Order With This Function <br />
     MakeOrder ();<br />
		<br />
  }<br />
<br />
<br />
<br />
}<br />
//Question 1<br />
else  //If Answer Is Not Yes The Action Modify Order Is Cancel<br />
cout<<"\n**ACTION CANCELED**\n";<br />
<br />
<br />
}<br />
<br />
<br />
<br />
//Show Order That Made By A Customer <br />
void ShowOrder ()<br />
{<br />
   int i;<br />
   <br />
   cout<<"\nCUSTOMER'S NAME: "<<CDBase[FindCustomerList].Name<<endl;  //Customer's Name<br />
cout<<"*ORDER*\n"; <br />
   for(i=0; i<CDBase[FindCustomerList].HowM; i++)<br />
   {<br />
	<br />
                                                   <br />
	cout<<"\nPLANT # : "<<i+1<<endl;                                     //Display Out Each Ordered Plant<br />
	cout<<"Name:   : "<<CDBase[FindCustomerList].Or[i].Order<<endl;      //The Ordered Quantity <br />
	cout<<"Quantity: "<<CDBase[FindCustomerList].Or[i].Quantity<<endl;   //The Cost<br />
	cout<<"COST    : "<<CDBase[FindCustomerList].Or[i].Invoice<<endl;   <br />
<br />
	cout<<"__________________________________________\n\n";<br />
<br />
   }<br />
    //Display The Total Invoice For This Order<br />
    cout<<"INVOICE : "<<CDBase[FindCustomerList].TotalInvoice<<endl;   <br />
	cout<<"__________________________________________\n\n";<br />
<br />
	//Display The Total Turnover For This Customer<br />
    cout<<"TURNOVER: "<<CDBase[FindCustomerList].TurnOver<<endl<<endl;<br />
<br />
}<br />
<br />
 <br />
<br />
//Make The Order<br />
void MakeOrder ()<br />
{<br />
	int i;<br />
	float inv=0.0;<br />
<br />
<br />
<br />
   cout<<"\n*SELECT PLANTS*\n";<br />
<br />
 //Loop Such Times As The Number Of Different Plants Cstomer Wants To Insert <br />
   for(i=0; i<CDBase[FindCustomerList].HowM; i++)<br />
   {<br />
     cout<<"PLANT #: "<<i+1<<endl;    <br />
     FindPlant ();                   //Find Plant Giving Its Family And Name<br />
	 <br />
	 //Displays Selected Plant's Name<br />
	 cout<<"SELECTED PLANT: "<<PDBase[FindPlantList].PlantFamily_Name <<endl;<br />
     <br />
	 //Asks For The Quantity<br />
	 cout<<"Quantity: "<<endl;<br />
	 cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
<br />
     if(PDBase[FindPlantList].NumOfThisInStock<=0)                //If The Quantity Of This Plant In Stock Is Zero<br />
	 {<br />
		 cout<<"There Are No Such Plants In Stock\n";             //Asks User To Change The Order By Selecting An Other Plant<br />
		 cout<<"Please Change Your Order.\n";<br />
		 cout<<"PLANT #: "<<i+1<<endl;<br />
         FindPlant ();<br />
	     cout<<"SELECTED PLANT: "<<PDBase[FindPlantList].PlantFamily_Name <<endl;<br />
         cout<<"Quantity: \n";<br />
         cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
	 }<br />
<br />
	 //If The New Quantity Is Bigger Than The Quantity Of This Plant In Stock<br />
	  if(CDBase[FindCustomerList].Or[i].Quantity>PDBase[FindPlantList].NumOfThisInStock)<br />
	 {<br />
		  //The Order Stop And Show How MAny Plant Of This Type Are Available<br />
		 cout<<"Order Stoped\n";<br />
		 cout<<"Available Quantity For This Is: "<<PDBase[FindPlantList].NumOfThisInStock<<endl;<br />
	     <br />
		 //Asks For A New Quantity<br />
		 cout<<"\nPlease Change Quantity. New Quantity: \n";<br />
         cin>>CDBase[FindCustomerList].Or[i].Quantity;<br />
	  }<br />
	 <br />
	  //Copy The Name Of Plant To The Array Order<br />
	  strcpy(CDBase[FindCustomerList].Or[i].Order, PDBase[FindPlantList].PlantFamily_Name);<br />
	  <br />
	  //Update The Number In Stock Of This Plant<br />
	  PDBase[FindPlantList].NumOfThisInStock=PDBase[FindPlantList].NumOfThisInStock-CDBase[FindCustomerList].Or[i].Quantity;<br />
      //Calculate The Invoice For Each Plant<br />
	  CDBase[FindCustomerList].Or[i].Invoice=CDBase[FindCustomerList].Or[i].Quantity*PDBase[FindPlantList].Price;<br />
	  //Find The Total Invoice<br />
	  inv=inv+CDBase[FindCustomerList].Or[i].Invoice;<br />
      //Keep The Quantity Sold Of This Plant<br />
	  PDBase[FindPlantList].QSell=PDBase[FindPlantList].QSell+CDBase[FindCustomerList].Or[i].Quantity;<br />
	  cout<<"Continue.\n";<br />
	 <br />
	 }<br />
   //Total Invoice For The Order<br />
   CDBase[FindCustomerList].TotalInvoice=inv;<br />
   //Total Turnover Of This Customer<br />
   CDBase[FindCustomerList].TurnOver=CDBase[FindCustomerList].TurnOver+CDBase[FindCustomerList].TotalInvoice;<br />
    <br />
   //Display The Order<br />
    ShowOrder ();<br />
<br />
<br />
<br />
<br />
}<br />
<br />
<br />
<br />
<br />
//Find Customer, <br />
void InsertOrder ()<br />
{<br />
	char q1; //Question 1<br />
    char q2; //Question 1<br />
	char q3; //Question 1<br />
	<br />
	int HowMany;<br />
<br />
cout<<"\n\t\t**ORDERING PROCESS**\n";<br />
<br />
//Question 1: Ask If He/She Want To Continue The Order<br />
cout<<"Are You Sure You Want To Continue Making An Order (y or n): "<<endl;<br />
cin>>q1;<br />
<br />
 if((q1=='y')||(q1=='Y'))   //If Answer Is Yes Program Continue The Ordering Process<br />
 {<br />
   cout<<"\n**FIND CUSTOMER**\n";<br />
<br />
   //Question 2: Ask If He/She Want To Show The Customers Are In The List<br />
   cout<<"Do You Want To Show First The Customers Are In The Database (y or n): "<<endl;<br />
   cin>>q2;<br />
      if((q2=='y')||(q2=='Y')) //If Answer Is Yes<br />
	  {<br />
       DisplayCustomers ();      //Displays The Customers Are In The Database<br />
       cout<<"\nThese Are The Customers In The List\n";<br />
       cout<<"\n*Select Customer*\n";<br />
       <br />
//Find And Select The Customer Who Is Going To Make This Order <br />
	   FindCustomer();<br />
	  }<br />
//If Answer Is No<br />
     else<br />
	 {<br />
//Select The Customer <br />
      cout<<"\n*SELECTED CUSTOMER*\n";<br />
      FindCustomer();                  //Find Customer Giving His/Her Social Security Number<br />
	 }<br />
//Display Selected Customer With His/Her Personal Information<br />
   cout<<"\n*SELECTED CUSTOMER*\n";<br />
   cout<<"_______________________\n"; <br />
   cout<<"CUSTOMER #: "<<FindCustomerList+1<<endl;<br />
   cout<<"NAME          : "<<CDBase[FindCustomerList].Name<<endl;<br />
   cout<<"ADDRESS       : "<<CDBase[FindCustomerList].Address<<endl;<br />
   cout<<"PHONE NUMBER  : "<<CDBase[FindCustomerList].Phone<<endl;<br />
   cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
   cout<<endl<<endl;<br />
<br />
  cout<<"*NOW YOU CAN INSERT THE ORDER*\n";<br />
  <br />
  //Question 3: Ask If User Wants To Show The Plants Are In The Database<br />
  cout<<"Do You Want To Show The Plants Are In The Database (y or n): \n";<br />
  cin>>q3;<br />
<br />
   if((q3=='y')||(q3=='Y'))   //If Answer Is Yes<br />
   {<br />
<br />
//Displays The Plants Are In The List<br />
   cout<<"\n\n**SHOW AVAILABLE PLANTS**"<<endl;<br />
   DisplayPlants ();<br />
   cout<<"\nThese Are The Available Plants\n\n";<br />
<br />
//And Ask The Number Of Different Plants He/She Is Going To Order <br />
   cout<<"Please Enter How Many Different Plants You Are Going To Order:\n";<br />
   cin>>HowMany;  <br />
   }<br />
<br />
 //Question 3: If Answer Is No <br />
   else<br />
   {<br />
//Ask Only The Number Of Different Plants He/She Is Going To Order<br />
   cout<<"Please Enter How Many Different Plants You Are Going To Order:\n";<br />
   cin>>HowMany;<br />
   }<br />
<br />
//This Value Stored In The Array (Same Place As The Information Of Customer)<br />
    CDBase[FindCustomerList].HowM=HowMany;<br />
<br />
//Make The Order<br />
    MakeOrder ();<br />
<br />
 }<br />
<br />
//Question 1: If Answer Is No<br />
 //Orderin Process Cancel<br />
  else<br />
   cout<<"*ACTION CANCELED*"<<endl;<br />
}<br />
 <br />
 <br />
  <br />
<br />
//Delete Plant<br />
void DeleteP ()<br />
{<br />
  int i;<br />
    char YorN;<br />
<br />
cout<<"\n**DELETE PLANT FROM DATABASE**\n";<br />
	cout<<"_________________________________\n";<br />
<br />
FindPlant ();       //Find The Plant Giving Its Family And Name<br />
<br />
    cout<<"PLANT #: "<<FindPlantList+1<<endl;<br />
	cout<<"FAMILY & NAME: "<<PDBase[FindPlantList].PlantFamily_Name<<endl;<br />
    cout<<"TYPE         : "<<PDBase[FindPlantList].Type<<endl;                    //Display Plant's Information<br />
	cout<<"COLOUR       : "<<PDBase[FindPlantList].Colour<<endl;                  //So The User To Be Sure That <br />
	cout<<"SIZE         : "<<PDBase[FindPlantList].Size<<endl;                    //This Is The Plant He/She Want<br />
	cout<<"IN STOCK     : "<<PDBase[FindPlantList].NumOfThisInStock<<endl;        //To Delete<br />
	cout<<"GARDEN PLANT : "<<PDBase[FindPlantList].ItIsGarden<<endl;<br />
	cout<<"PRICE        : "<<PDBase[FindPlantList].Price<<endl;<br />
	cout<<endl;<br />
<br />
//Ask User If He/She Is Sure He/She Want To Delete This Plant<br />
	cout<<"Are You Sure You Want To Delete This Plant (y or n): "<<endl;<br />
 cin>>YorN;<br />
<br />
  if((YorN=='y')||(YorN=='Y'))  //If Answer Is Yes<br />
 {<br />
    for(i=FindPlantList; i<NoOfPlants; i++)  //Loop From The Place That Is The Selected Up To The  <br />
	{                                         //Number Of The Plants In The List<br />
<br />
      strcpy(PDBase[i].PlantFamily_Name, PDBase[i+1].PlantFamily_Name);  //Change Cell In The Array<br />
	  strcpy(PDBase[i].Type, PDBase[i+1].Type);<br />
	  strcpy(PDBase[i].Size, PDBase[i+1].Size);<br />
	  PDBase[i].NumOfThisInStock=PDBase[i+1].NumOfThisInStock;<br />
	  strcpy(PDBase[i].ItIsGarden, PDBase[i+1].ItIsGarden);<br />
	  PDBase[i].Price=PDBase[i+1].Price;<br />
	}<br />
	NoOfPlants=NoOfPlants-1;   //Number Of Plants In The List Less 1 <br />
	if (NoOfPlants < 0)<br />
	{<br />
		NoOfPlants=0;  //The Smaller Value That The Counter Of Plants In The Database Can Have Is Zero<br />
	}<br />
	cout<<"*PLANT DELETED*"<<endl;<br />
  }<br />
//If Answer Is No The Action Is Canceled<br />
  else<br />
	  cout<<"*ACTION CANCELED*"<<endl;<br />
}<br />
<br />
<br />
//Delete Customer<br />
void DeleteC ()<br />
{<br />
	int i;<br />
    char YorN;<br />
<br />
	cout<<"\n**DELETE CUSTOMER FROM DATABASE**\n";<br />
	cout<<"_________________________________\n";<br />
<br />
	FindCustomer();                                //Find Customer Giving His/Her Social Security Number <br />
<br />
   cout<<"CUSTOMER #: "<<FindCustomerList+1<<endl;<br />
   cout<<"NAME          : "<<CDBase[FindCustomerList].Name<<endl;               //Display Selected Customer<br />
   cout<<"ADDRESS       : "<<CDBase[FindCustomerList].Address<<endl;<br />
   cout<<"PHONE NUMBER  : "<<CDBase[FindCustomerList].Phone<<endl;<br />
   cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
   cout<<endl<<endl;<br />
<br />
<br />
//Ask If He/She Is Sure He/She Want To Delete This Customer<br />
 cout<<"Are You Sure You Want To Delete This Customer (y or n): "<<endl;<br />
 cin>>YorN;<br />
<br />
 if((YorN=='y')||(YorN=='Y'))   //If Answer is Yes<br />
 {<br />
	for(i=FindCustomerList; i<NoOfCustomers; i++)  //Loop From The Place In Array That Is This Customer<br />
	{                                               //Up To The Number Of Customers In The List<br />
		strcpy(CDBase[i].Name, CDBase[i+1].Name);<br />
		strcpy(CDBase[i].Address, CDBase[i+1].Address);     //Change Cell In The Array<br />
		strcpy(CDBase[i].Phone, CDBase[i+1].Phone);<br />
        strcpy(CDBase[i].SocialSecurityNum, CDBase[i+1].SocialSecurityNum);<br />
	}<br />
	NoOfCustomers=NoOfCustomers-1;<br />
	if (NoOfCustomers < 0)<br />
	{<br />
		NoOfCustomers=0;     //The Smaller Value That The Counter Of Customers In The Database Can Have Is Zero<br />
	}<br />
	cout<<"*CUSTOMER DELETED*"<<endl;<br />
 }<br />
 //If Answer Is No The Delete Action Is Cancel<br />
else <br />
	 cout<<"*ACTION CANCELED*"<<endl;<br />
}<br />
<br />
<br />
<br />
//Modify Plant's Information<br />
void ModifyPlant ()<br />
{<br />
	char YorN;<br />
<br />
	cout<<"\n**MODIFY PLANT'S INFORMATION**\n";<br />
	cout<<"______________________________\n";<br />
    FindPlant ();                               //Find Plant To Modify Giving Its Family And Name<br />
 <br />
	cout<<"PLANT #: "<<FindPlantList+1<<endl;<br />
	cout<<"FAMILY & NAME: "<<PDBase[FindPlantList].PlantFamily_Name<<endl;<br />
    cout<<"TYPE         : "<<PDBase[FindPlantList].Type<<endl;                   //Displays Out The Information<br />
	cout<<"COLOUR       : "<<PDBase[FindPlantList].Colour<<endl;                 //Of This Plant<br />
	cout<<"SIZE         : "<<PDBase[FindPlantList].Size<<endl;<br />
	cout<<"IN STOCK     : "<<PDBase[FindPlantList].NumOfThisInStock<<endl;<br />
	cout<<"GARDEN PLANT : "<<PDBase[FindPlantList].ItIsGarden<<endl;<br />
	cout<<"PRICE        : "<<PDBase[FindPlantList].Price<<endl;<br />
	cout<<endl<<endl;<br />
<br />
    cout<<"Now Enter The New Information For This Plant\n "<br />
		<<"(You Can't Change Plant's Family & Name)\n";<br />
	cout<<"_____________________________________________\n";<br />
<br />
<br />
	cout<<"Are You Sure You Want To Modify This Plant (y or n): "<<endl;<br />
    cin>>YorN;<br />
	//If Answer Is Yes Program Continues With The Modification<br />
  if((YorN=='y')||(YorN=='Y'))<br />
	{<br />
	cout<<"**MODIFICATIONS**: "<<endl;<br />
	cout<<"TYPE: "<<endl;<br />
	gets(PDBase[FindPlantList].Type);             //User Can Modify Some Of Plant's Info<br />
	cout<<"COLOUR: "<<endl;<br />
	gets(PDBase[FindPlantList].Colour);<br />
	cout<<"SIZE: "<<endl;<br />
	gets(PDBase[FindPlantList].Size);<br />
	cout<<"HOW MANY ARE IN STOCK: "<<endl;<br />
	cin>>PDBase[FindPlantList].NumOfThisInStock;<br />
	cout<<"IT IS A GARDEN PLANT: "<<endl;<br />
	gets(PDBase[FindPlantList].ItIsGarden);<br />
	cout<<"PRICE: "<<endl;<br />
	cin>>PDBase[FindPlantList].Price;<br />
<br />
    cout<<"\n\n**You Have Modify "<<PDBase[FindPlantList].PlantFamily_Name<<" Information**\n";<br />
  }<br />
else<br />
//If Answer Is No Modification Action Canceled<br />
    cout<<"*ACTION CANCELED*"<<endl;<br />
}<br />
<br />
//Find Plant's Place In The List<br />
void FindPlant ()<br />
{<br />
	int i;<br />
	int Finder=0;     //Counts And Find The Cell In The Array Where The Plant User Looking For Is<br />
	char PFamily_Name[40];  //User Insert The Family And The Name Of The Plant He/She Want To Find<br />
    int tmp1=0;<br />
    <br />
<br />
	cout<<"Please Enter Plant's Family & Name (ie.Family(space)Name): "<<endl;<br />
	gets(PFamily_Name);<br />
<br />
<br />
	for(i=0; i<NoOfPlants; i++)   //Loop Number Of Plants (NoOfPlants) Are In The Array<br />
	{<br />
		tmp1=strcmp(PDBase[i].PlantFamily_Name, PFamily_Name);  //Compare With Evry Plant In The Array<br />
	<br />
//This Is Not Working Correctly With The (tmp1 != 0)<br />
//Using This (tmp1 !=1) Is Working Ok!!!<br />
		if (tmp1 != 1)<br />
		{                  //If The Input Name Is Not The Same With The Compared Plant's Name In The Array<br />
			Finder++;      //Counter "Finder" incresing By 1<br />
		}<br />
	}<br />
<br />
//Counter "Finder" - 1 Is Equal To The Place (CELL) In The Array  <br />
FindPlantList=Finder-1;<br />
<br />
<br />
}<br />
<br />
<br />
//Modify Customers Information<br />
void ModifyCustomer ()<br />
{<br />
	char YorN;<br />
<br />
   cout<<"\n**MODIFY CUSTOMER'S INFORMATION**\n";<br />
   cout<<"____________________________________\n\n";<br />
<br />
   FindCustomer();                                       //Find The Customer Giving His/Her Social Security Number<br />
   cout<<"CUSTOMER #: "<<FindCustomerList+1<<endl;<br />
   cout<<"NAME          : "<<CDBase[FindCustomerList].Name<<endl;<br />
   cout<<"ADDRESS       : "<<CDBase[FindCustomerList].Address<<endl;<br />
   cout<<"PHONE NUMBER  : "<<CDBase[FindCustomerList].Phone<<endl;<br />
   cout<<"SOCIAL SEC NUM: "<<CDBase[FindCustomerList].SocialSecurityNum<<endl;<br />
   cout<<endl<<endl;<br />
   cout<<"\nNow Enter The New Information For This Customer\n "<br />
	   <<"(You Can't Change Name & Social Security Number)\n";<br />
   cout<<"_________________________________________________\n";<br />
<br />
//Ask User Is He/She Is Sure He/She Want To Continue Modify This Customer<br />
   	cout<<"Are You Sure You Want To Modify This Customer (y or n): "<<endl;<br />
    cin>>YorN;<br />
<br />
	//If Answer Is Yes<br />
  if((YorN=='y')||(YorN=='Y'))<br />
  {                                           //User Can Change Some Of The Information<br />
   cout<<"**MODIFICATIONS**: "<<endl;<br />
   cout<<"ADDRESS: "<<endl;<br />
   gets(CDBase[FindCustomerList].Address);<br />
   cout<<"PHONE NUMBER: "<<endl;<br />
   gets(CDBase[FindCustomerList].Phone);<br />
   <br />
cout<<"\n\n**You Have Modify "<<CDBase[FindCustomerList].Name<<" Information**\n";<br />
  }<br />
//If Answer Is No Modification Process Is Canceled<br />
else<br />
    cout<<"*ACTION CANCELED*"<<endl;<br />
<br />
}<br />
<br />
//Find Customer's Place In The List<br />
void FindCustomer()<br />
{<br />
	int i;<br />
	int Finder=0;     //Counts To Find The Cell In The Array Where Is The Customer User Looking For<br />
    char Social[15];  //The Social Security Number Of Customer User Is Looking<br />
    int tmp=0;<br />
    <br />
	cout<<"Enter Customer Social Number: "<<endl;<br />
	gets(Social);<br />
<br />
	for(i=0; i<NoOfCustomers; i++)<br />
	{<br />
		tmp=strcmp(CDBase[i].SocialSecurityNum, Social);  //Compare With Evry Customer In The Array<br />
<br />
//This Is Not Working Correctly With The (tmp1 != 0)<br />
//Using This (tmp1 !=1) Is Working Ok!!! <br />
		if (tmp != 1)                           //If Is Not The Same Counter "Finder" Is Incresing By 1 <br />
		{<br />
			Finder++;<br />
		}<br />
	}<br />
<br />
//"Finder"-1 Is Equal To The Place (cell) In The Array That This Customer Is <br />
FindCustomerList=Finder-1;<br />
<br />
<br />
}<br />
<br />
<br />
<br />
//Return How Many Customers Are In The List And How Many Can Still Insert In The Database<br />
//Displays The Customers Are In The Array In Alphabetical Order<br />
void HowManyCustomers ()<br />
{<br />
<br />
 cout<<endl; <br />
	DisplayCustomers ();   //Displays Customers In Alphabetical Order<br />
<br />
//Display How Many Customers Are In The List<br />
	cout<<"\nThere Are "<<NoOfCustomers<<" Customers In The Database."<<endl;<br />
//Calculate And Display How Many Customers Can Still Be Insert In The List	<br />
	counterC=MaxNoOfCustomers-NoOfCustomers;<br />
	cout<<"You Can Still Insert "<<counterC<<" Other Customers In The Database."<<endl;<br />
<br />
}<br />
<br />
<br />
//Display Out In Alphabetical Order All Customers With There Personal Information  <br />
void DisplayCustomers ()<br />
{<br />
	int i;<br />
<br />
	for(i=0; i<NoOfCustomers; i++) //Loop Number Of Customer Times<br />
	{<br />
		cout<<endl;                                      //Customer's Information<br />
		cout<<"CUSTOMER #: "<<i+1<<endl;<br />
		cout<<"NAME            : "<<CDBase[i].Name<<endl;<br />
		cout<<"ADDRESS         : "<<CDBase[i].Address<<endl;<br />
		cout<<"PHONE NUMBER    : "<<CDBase[i].Phone<<endl;<br />
		cout<<"SECURITY NUMBER : "<<CDBase[i].SocialSecurityNum<<endl;<br />
        cout<<"____________________________________\n"<<endl;<br />
	}<br />
<br />
}<br />
<br />
//Display Out In Alphabetical Order All Plants With There Information<br />
void DisplayPlants ()<br />
{<br />
	int i;<br />
	<br />
	 for(i=0; i<NoOfPlants; i++)   //Loop Number Of Plants In The Array Times<br />
	 {<br />
		 cout<<endl;<br />
		 cout<<"PLANT #: "<<i+1<<endl;                            //Plant's Information<br />
		 cout<<"FAMILY & NAME :  "<<PDBase[i].PlantFamily_Name<<endl;<br />
		 cout<<"TYPE          :  "<<PDBase[i].Type<<endl;<br />
		 cout<<"COLOUR        :  "<<PDBase[i].Colour<<endl;<br />
		 cout<<"SIZE          :  "<<PDBase[i].Size<<endl;<br />
		 cout<<"IN STOCK      :  "<<PDBase[i].NumOfThisInStock<<endl;<br />
		 cout<<"GARDEN PLANT  :  "<<PDBase[i].ItIsGarden<<endl;<br />
		 cout<<"PRICE         :  "<<PDBase[i].Price<<endl;<br />
	     cout<<"____________________________________\n"<<endl;<br />
<br />
     }<br />
}<br />
<br />
//Return How Many Plants Are In The List And How Many Can Still Insert In The Database<br />
void HowManyPlants ()<br />
{<br />
<br />
    cout<<endl; <br />
	DisplayPlants ();   //Display Plants Are In The Array In Alphabetical Order<br />
<br />
//Display How Many Plants Are In The List<br />
	cout<<"\nThere Are "<<NoOfPlants<<" Different Plants In Stock In The Database."<<endl;<br />
//Calculate And Display How Many Plants Can Still Be Insert In The Array	<br />
	counterP=MaxNoOfPlants-NoOfPlants;<br />
	cout<<"You Can Still Insert "<<counterP<<" Plants In The Database."<<endl;<br />
<br />
}<br />
<br />
<br />
//Insert New Customer In The Database. Keep Them In Alphabetical Order<br />
void ReadNewCustomer ()<br />
{<br />
<br />
int i=0,j=0;<br />
char tempCName[30];               //These Temps Used In Order To Keep Customers In The Array In Aplhabetical Order<br />
char tempCAddress[80];<br />
char tempCPhone[10];<br />
char tempCSecurity[15];<br />
<br />
int tmp, tmp1;<br />
<br />
    cout<<"\nCUSTOMER #: "<<NoOfCustomers+1<<endl;     //User Insert Customer's Information <br />
	cout<<"NAME: "<<endl;<br />
	gets(CDBase[NoOfCustomers].Name);<br />
	cout<<"ADDRESS: "<<endl;<br />
	gets(CDBase[NoOfCustomers].Address);<br />
	cout<<"PHONE NUMBER: "<<endl;<br />
	gets(CDBase[NoOfCustomers].Phone);<br />
	cout<<"ENTER SOCIAL SECURITY NUMBER:\n " <br />
		<<"First Enter The First Letter Of \n"<br />
		<<"His/Her First & Last Name & Then The Number\n"<br />
		<<"(eg. If Name Is 'Nicholas Try' Write:EC22332): "<<endl;  //This Beacause We Sort And Accorting The Social Security Number<br />
	gets(CDBase[NoOfCustomers].SocialSecurityNum);<br />
<br />
     NoOfCustomers++;   //Number Of Customers In The Array Increasing By One<br />
<br />
for(i=0; i<NoOfCustomers; i++)                 //Alphabetical Order<br />
{<br />
	 for(j=0; j<NoOfCustomers; j++)<br />
     {<br />
		 tmp=strcmp(CDBase[i].Name, CDBase[j].Name);<br />
		 tmp1=strcmp(CDBase[i].SocialSecurityNum, CDBase[j].SocialSecurityNum);<br />
<br />
		 if ((tmp<0)&&(tmp1<0))                      //If The Next Customer Is Smaller(Alphabetically)<br />
         {<br />
			 strcpy(tempCName, CDBase[i].Name);        //Exchange Cells In The Array<br />
			 strcpy(tempCAddress, CDBase[i].Address);<br />
			 strcpy(tempCPhone, CDBase[i].Phone);<br />
             strcpy(tempCSecurity, CDBase[i].SocialSecurityNum);<br />
<br />
             strcpy(CDBase[i].Name, CDBase[j].Name);<br />
			 strcpy(CDBase[i].Address, CDBase[j].Address);<br />
			 strcpy(CDBase[i].Phone, CDBase[j].Phone);<br />
			 strcpy(CDBase[i].SocialSecurityNum, CDBase[j].SocialSecurityNum);<br />
<br />
             strcpy(CDBase[j].Name, tempCName);<br />
			 strcpy(CDBase[j].Address, tempCAddress);<br />
			 strcpy(CDBase[j].Phone, tempCPhone);<br />
			 strcpy(CDBase[j].SocialSecurityNum, tempCSecurity);<br />
		 }<br />
	 }<br />
}<br />
<br />
}<br />
<br />
<br />
//Insert New Plant In The Database. Keep Them In Alphabetical Order<br />
void ReadNewPlant ()<br />
{<br />
 int i=0,j=0;<br />
<br />
<br />
char tempPFamily_Name[30];      //These Temps Used To Keep Plants In The Array In Alphabetical Order<br />
char tempPType[8];<br />
char tempPColour[10];<br />
char tempPSize[8];<br />
int tempPInStock;<br />
char tempPIsAGarden[3];<br />
float tempPPrice=0.0;<br />
int tmp1;<br />
<br />
//User Asked About Plant's Information<br />
<br />
        cout<<"\nPLANT #: "<<NoOfPlants+1<<endl;<br />
        cout<<"ENTER PLANT'S FAMILY & NAME (ie. Family(space)Name): "<<endl;<br />
		gets(PDBase[NoOfPlants].PlantFamily_Name);<br />
        cout<<"ENTER ITS TYPE(Flower Or Tree): "<<endl;<br />
		gets(PDBase[NoOfPlants].Type);<br />
        cout<<"ENTER THE COLOUR OF ITS BLOSSOM: "<<endl;<br />
		gets(PDBase[NoOfPlants].Colour);<br />
		cout<<"PLEASE ENTER ITS SIZE(Small, Medium, Large): "<<endl;<br />
		gets(PDBase[NoOfPlants].Size);<br />
        cout<<"HOW MANY OF THIS PLANT ARE IN STOCK: "<<endl;<br />
		cin>>PDBase[NoOfPlants].NumOfThisInStock;		<br />
		cout<<"IT IS A GARDEN FLOWER ? (Yes Or No): "<<endl;<br />
		gets(PDBase[NoOfPlants].ItIsGarden);<br />
		cout<<"ENTER ITS PRICE: "<<endl;<br />
		cin>>PDBase[NoOfPlants].Price; <br />
		cout<<endl;<br />
        //counter1=counter1+PDBase[NoOfPlants].NumOfThisInStock;<br />
		<br />
        NoOfPlants++; 		//Number Of Plants In The Array Increase By 1 <br />
        <br />
<br />
for(i=0; i<NoOfPlants; i++)                        //Alphabetical Order<br />
{<br />
	for(j=0; j<NoOfPlants; j++)                                 //If Next Plant's Family And Name Is Smaller(Alphabetically)<br />
	{                        <br />
		 tmp1=strcmp(PDBase[i].PlantFamily_Name, PDBase[j].PlantFamily_Name);<br />
                                                               //Exchange Cells In The Array<br />
		 if (tmp1<0)<br />
		 {<br />
			 strcpy(tempPFamily_Name, PDBase[i].PlantFamily_Name);<br />
             strcpy(tempPType, PDBase[i].Type);<br />
			 strcpy(tempPColour, PDBase[i].Colour);<br />
			 strcpy(tempPSize, PDBase[i].Size);<br />
			 tempPInStock=PDBase[i].NumOfThisInStock;<br />
			 strcpy(tempPIsAGarden, PDBase[i].ItIsGarden);<br />
			 tempPPrice=PDBase[i].Price;<br />
<br />
			 strcpy(PDBase[i].PlantFamily_Name, PDBase[j].PlantFamily_Name);<br />
             strcpy(PDBase[i].Type, PDBase[j].Type);<br />
			 strcpy(PDBase[i].Colour, PDBase[j].Colour);<br />
			 strcpy(PDBase[i].Size, PDBase[j].Size);<br />
			 PDBase[i].NumOfThisInStock=PDBase[j].NumOfThisInStock;<br />
			 strcpy(PDBase[i].ItIsGarden, PDBase[j].ItIsGarden);<br />
             PDBase[i].Price=PDBase[j].Price;<br />
            <br />
             strcpy(PDBase[j].PlantFamily_Name, tempPFamily_Name);<br />
			 strcpy(PDBase[j].Type, tempPType);<br />
			 strcpy(PDBase[j].Colour, tempPColour);<br />
             strcpy(PDBase[j].Size, tempPSize);<br />
             PDBase[j].NumOfThisInStock=tempPInStock;<br />
			 strcpy(PDBase[j].ItIsGarden, tempPIsAGarden);<br />
			 PDBase[j].Price=tempPPrice;<br />
<br />
<br />
		 }<br />
	}<br />
}<br />
<br />
}<br />
<br />
//Display The Main Menu<br />
void ShowMenu ()<br />
{<br />
    cout<<"________________________________________________________________________________"<<endl;<br />
    cout<<"\t\t\t NURSERY GARDEN COMPANY\n";<br />
	cout<<"\t\t    ********************************\n";<br />
	cout<<"\t\t\t\tMAIN MENU\n\n";<br />
	cout<<" 0.EXIT\n";<br />
	cout<<" 1.Read The Information For A New Plant.\n";<br />
	cout<<" 2.Read The Information For A New Customer. \n";<br />
	cout<<" 3.Show How Many Plants Are In The List - How Many Can Still Be Inseret.\n";<br />
	cout<<" 4.Show How Many Customers Are In The List - How Many Can Still Be Insert. \n";<br />
	cout<<" 5.Delete A Plant Given Its Family And Name.\n";<br />
	cout<<" 6.Delete A Customer Given His/Her Social Security Number.\n";<br />
	cout<<" 7.Insert An Order.\n";<br />
	cout<<" 8.Modify The Data For A Particular Plant.\n";<br />
	cout<<" 9.Modify The Data For A Particular Customer.\n";<br />
	cout<<"10.Modify An Order.\n";<br />
	cout<<"11.View An Order.\n";<br />
	cout<<"12.View Reports.\n";<br />
<br />
	cout<<"________________________________________________________________________________\n";<br />
cout<<endl;<br />
}<br />
<br />
//Execude User's Choice<br />
void ChooseMenu (int menu)<br />
{<br />
	switch (menu)<br />
	{<br />
	case 0:<br />
		cout<<"\nEXIT............. BYE BYE!!!\n\n";<br />
		break;<br />
	case 1:<br />
          ReadNewPlant ();<br />
		  break;<br />
	case 2:<br />
           ReadNewCustomer ();<br />
		   break;<br />
	case 3:<br />
            HowManyPlants ();<br />
			break;<br />
<br />
	case 4:<br />
		   HowManyCustomers ();<br />
		   break;<br />
<br />
	case 5:<br />
            DeleteP ();<br />
             break;<br />
<br />
	case 6:<br />
           DeleteC ();<br />
		   break;<br />
<br />
	case 7:<br />
           InsertOrder ();<br />
		   break;<br />
    case 8:<br />
           ModifyPlant ();<br />
		   break;<br />
	case 9:<br />
		   ModifyCustomer ();<br />
           break;<br />
	case 10:<br />
            ModifyOrder ();<br />
			break;<br />
<br />
	case 11:<br />
            ViewOrder ();<br />
			break;<br />
<br />
	case 12:<br />
         ReportChoose ();<br />
		   break;<br />
<br />
    default:<br />
		{<br />
			cout<<"INVALID NUMBER"<<endl;<br />
			<br />
				cout<<"Insert one of the above: ";<br />
			cin>>menu;<br />
			<br />
            <br />
		}<br />
	}<br />
}<br />
<br />
//Main Program<br />
void main ()<br />
{<br />
	<br />
	do<br />
	{<br />
		ShowMenu (); //View Menu<br />
		cout<<"Choose an action: ";<br />
        cin>>menu;<br />
		ChooseMenu (menu);<br />
	}while(menu != 0);<br />
}<br />
<br />
<br />
<br />

GeneralRe: C++ Pin
Anonymous18-May-05 3:36
Anonymous18-May-05 3:36 
GeneralRe: C++ Pin
Anonymous18-May-05 3:37
Anonymous18-May-05 3:37 
GeneralRe: C++ Pin
Anonymous18-May-05 3:37
Anonymous18-May-05 3:37 
GeneralRe: C++ Pin
Anonymous18-May-05 3:37
Anonymous18-May-05 3:37 
GeneralRe: C++ Pin
Anonymous18-May-05 3:38
Anonymous18-May-05 3:38 
GeneralRe: C++ Pin
Anonymous18-May-05 4:19
Anonymous18-May-05 4:19 
GeneralRe: C++ Pin
Anonymous18-May-05 4:19
Anonymous18-May-05 4:19 
GeneralRe: C++ Pin
Anonymous18-May-05 3:50
Anonymous18-May-05 3:50 
GeneralRe: C++ Pin
Anonymous18-May-05 3:50
Anonymous18-May-05 3:50 
GeneralRe: C++ Pin
Anonymous18-May-05 3:30
Anonymous18-May-05 3:30 
GeneralRe: C++ Pin
Anonymous18-May-05 4:22
Anonymous18-May-05 4:22 
GeneralRe: C++ Pin
User 58385218-May-05 2:16
User 58385218-May-05 2:16 
GeneralC++ Check my project please Pin
NicholasTryf18-May-05 3:14
sussNicholasTryf18-May-05 3:14 
GeneralRe: C++ Check my project please Pin
toxcct18-May-05 3:17
toxcct18-May-05 3:17 
GeneralC++ Check my project please Pin
Tasos32132118-May-05 3:15
sussTasos32132118-May-05 3:15 
GeneralC++ Check my project please Pin
GiorgePaf18-May-05 3:16
sussGiorgePaf18-May-05 3:16 
GeneralRe: C++ Check my project please Pin
Anonymous18-May-05 3:33
Anonymous18-May-05 3:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.