• Like
THE CUBE: Antique Store
Upcoming SlideShare
Loading in...5
×

THE CUBE: Antique Store

  • 342 views
Uploaded on

This is the project i made for my 12th grade. …

This is the project i made for my 12th grade.

Using basic C++, I made this software (which i call 'The Cube') capable of handling operations ranging from displaying store items to money tracking.

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
342
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
5
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. CERTIFICATE This is to certify that Neil Mathew, Roll No: _____ , has successfully completed his Project under my guidance and has fulfilled the requirements for the submission of this project. Ms. Geetu Munjal, _________________
  • 2. CONTENTS S No: Name: Page No: 1 ACKNOWLEDGEMENT 1[1-1] 2 INTRODUCTION 2 [ 1-2 ] 3 THE 6 FACES OF THE CUBE 3 [ 1–2 ] 4 FLOW CHART DIAGRAM 4 [ 1-4 ] 5 USER DEFINED FUNCTIONS 5 [ 1-1 ] 6 PROGRAM CODE 6 [ 1-17 ] 7 SAMPLE INPUT & OUTPUT 7 [ 1-33 ] 8 BIBLIOGRAPHY 8 [ 1-1 ] 9 SCOPE FOR FUTURE EXPANSION 9 [ 1-1 ]
  • 3. ACKNOWLEDGEMENT I am indebted to my computer teacher, Ms Geetu Munjal for her guidance and whole hearted support in the making of this project. 1: [1]
  • 4. INTRODUCTION I call this software ‘THE CUBE’. This is mainly because of the fact that it performs 6 types of tasks. Three of them are general while the other three are user specific. The Cube is made for 3 types of users: A Customer, A Supplier and The Manager. A more elaborate coverage of The Cube’s function can be seen in ‘THE 6 FACES OF THE CUBE”. This software is made to cover the processes associated with an Antique Store. Its applications extend to customers, suppliers, cashiers, managers and other staff members alike. Besides allowing us to view and search the items on sale, its main priority is maintaining a record of the transaction of money and items. With a buy, an item is lost and its price is added to the store balance. Similarly, If the manager was to accept a Supplier’s offer, that items asked price would be subtracted from the store balance and be added to the list of items on sale. This allows the Store to have a constantly updated reference to check the progress of the store. 2:[1]
  • 5. INTRODUCTION To make it implementable in the real world, I have ensured that: (1) Data is stored in files and opened in binary mode for speed. (2) The interface has been made interactive and user friendly. (3) It has covered all possible threats to efficacy by means of Intensive Exception Handling like: (i) Invalid Entries by User (ii) An Advanced Search that is NOT case sensitive. (iii) And many others like: Maintaining transfer of cash through sale and purchase of the store, Maintaining Transfer of Data from Supplier Offer to Item On Sale, etc 2: [2]
  • 6. THE 6 FACES OF THE CUBE This is a more elaborate explanation of THE CUBE and the various tasks that it performs. THE LIST This is a Tabular representation of the list of items on sale in the 1 store. The following 4 entities are displayed here. SPACING TOOL  The Item number  The Name There is a function  The Age (in Years) which is responsible for the tabular  The Cost format of THE LIST. THE HISTORY 2 This is a more detailed view of the items in THE LIST. It not only gives the 4 entities in THE LIST but also shows the history of the item and its significance in the past. However, only a limited number of items can be seen at a time. THE SEARCH 3 This allows users to search for an item, making it much easier than going through the long list to find something specific. The search allows us to narrow down the list by  Providing Ranges in the Cost and Age  A word search for Name and History. 3: [1]
  • 7. THE 6 FACES OF THE CUBE I AM A CUSTOMER This is one of the 3 user specific options. 4 If this is chosen, the user will be able to choose and buy the item of his choice. Once the money transfer is complete:  A bill for the user will be displayed.  There will be an increase in the store balance.  The item will be removed from THE LIST. CUBE CASHIER I AM A SUPPLIER This is a money organizer for the store. When an item is sold or bought by This option is for those who have something the store, the balance to sell to the store. increases and decreases 5 accordingly. The user will have to enter the details of the item he wishes to sell including the price he is asking for it. This will be stored and decided later by the manager. When the manager accepts:  The item will be added to the LIST.  There will be a decrease in the store balance. I AM THE MANAGER 6 This option is for the manager. Since this is restricted to the general public, it is password protected. The Manager has the most number of options. He can add, delete and edit an item on THE LIST. He can change the password and access the CUBE CASHIER. 3: [2]
  • 8. DISPLAY THE VARIOUS OPTIONS: START (1) THE LIST | (2) THE HISTORY | (3) THE SEARCH | CHOOSE | (4) I AM A CUSTOMER | (5) I AM A SUPPLIER | (6) I AM THE MANAGER (Input Ch) Ch=1 Ch=2 Ch=3 Ch=4 Ch=5 Ch=6 Ch=0 IF ELSE CH=1 || CH=2 || CH=3 1 2 3 4 5 6 || CH=4 || CH=5 || CH=6 || SHOW CH=0 ERROR MESSAGE RESTART 0 THE DO WHILE LOOP END FLOW CHART DIAGRAM
  • 9. 3 1 void view() SHOWS THE LIST OF ITEMS 0 DISPLAYS THE VARIOUS OPTIONS Call Call | PROVIDE RANGES IN (1) AGE (2) COST void SORT_LIST() void Space() SORTS THE LIST ACCORDING PROVIDES TABULAR FORMAT | A WORD SEARCH FOR (3) NAME OF ITEM (4) HISTORY TO ASCENDING ITEMNO FOR THE LIST Call Call CHOOSE (Input Ch) void viewHis() 2 SHOWS THE LIST OF ITEMS 0 WITH HISTORY OF EACH IF CH=1 || CH=2 Ch=1 Ch=2 Ch=3 Ch=4 || CH=3 || CH=4 ASKS FOR ASKS FOR ASKS FOR ASKS FOR UPPER LIMIT & UPPER LIMIT & THE WORD TO THE WORD TO LOWER LIMIT LOWER LIMIT SEARCH FOR SHOW SEARCH FOR THEN DISPLAYS THEN DISPLAYS THEN DISPLAYS THEN DISPLAYS ELSE ERROR THE SEARCH THE SEARCH THE SEARCH THE SEARCH MESSAGE RESULTS RESULTS RESULTS RESULTS 0 FLOW CHART DIAGRAM
  • 10. 5 4 SHOW SHOW: ASKS HOW MANY ITEMS THE ASKS FOR ITEM NO: TO BUY: SUPPLIER IS WILLIING TO SELL. ENTER ITEMNO ENTER (INPUT CHK) (Input num) 0 SHOW: SHOW WHICH ALL IF DETAILS OF ITEM IS CHK REQUIRED: TRUE SHOW: COINCIDES WITH THE BILL OF ALL EXISTING TRUE ITEMS PURCHASED ITEM NO ENTER THE DETAILS IF FALSE OK = ‘Y’ FALSE || IF SHOW: OK= ‘y’ num LOOPS FALSE ASKS WHETHER TO BUY MORE? (y/n) ARE COMPLETED. ENTER (INPUT OK) FLOW CHART DIAGRAM
  • 11. SHOW ENTER 6 “ENTER PASSWORD” (Input PW) SHOW “WRONG PASSWORD” DISPLAYS THE VARIOUS OPTIONS CHOOSE | (1) CHANGE YOUR PASSWORD. TRUE IF (Input Ch) | (2) ADD AN ITEM TO THE LIST. PW == PASS | (3) DELETE AN ITEM ON THE LIST. FALSE | (4) EDIT AN ITEM ON THE LIST. | (5) USE THE CUBE CASHIIER 0 | (0) EXIT IF CH=1 || CH=2 || CH=3 ELSE || CH=4 || CH=5 Ch=0 || CH=0 Ch=2 Ch=4 void EDIT() void ADD() ACCORDING TO THE ITEM NO ALLOWS MANAGER TO ADD INPUTTED, DETAILS CAN BE CHANGED CHANGES THE RECORDS/ITEMS FROM STRING STORED IN (1) SUPPLIER Ch=3 PASS OF CLASS Ch=1 (HIS ITEMS’S DETAILS ARE void DEL() MANAGER WHICH SHOWN AND USER CAN Ch=5 ACCORDING TO THE ITEM NO INPUTTED, IS LATER STORED ACCEPT OR DECLINE THE void CCASH() ITEM & ITS DETAILS ARE DELETED. INTO A DATAFILE. SUPPLIER’S OFFER ) ALLOWS USER TO (2) FROM MANAGER VIEW, DEPOSIT AND ( HE CAN ADD THE ITEMS WITHDRAW FROM HIS HIMSELF TO THE STORE ) STORES’ BALANCE 0 FLOW CHART DIAGRAM
  • 12. USER DEFINED FUNCTIONS . 1 VOID VIEW() - THE LIST DISPLAYS THE ITEMS IN TABULAR FORMAT 2 1 THE HISTORY VOID VIEWHIS() - SHOWS THE HISTORY OF THE ITEM 1 3 THE SEARCH VOID SEARCH() - FINDS AN ITEM BY SEARCHING FOR KEYWORDS IN NAME, AND RANGE IN AGE AND COST 1 4 I AM A CUSTOMER VOID BUY() - ALLOWS USER TO BUY ITEMS ON THE LIST 1 5 I AM A SUPPLIER VOID SELL() - ALLOWS USER TO SELL ITEMS TO STORE 1 6 I AM THE MANAGER  VOID PW() – CHANGES PASSWORD TO ENTER THIS  VOID CCASH() – CUBE CASHIER ALLOWING USER TO DEPOSIT, WITHDRAW AND VIEW STORE’S BALANCE  VOID EDIT() – EDITS INFO OF EXISTING ITEM IN LIST  VOID ADD() – ADDS AN ITEM TO LIST (INDIRECTLY FROM SUPPLIER OR DIRECTLY FROM MANAGER)  VOID DEL() – DELETES AN EXISTING ITEM FROM LIST 1 0 OTHERS  VOID SPACE() – RESPONSIBLE FOR PROPER SPACING OF STRINGS AND INTEGERS (FUNCTION OVERLOADING)  INT FIND_IT() – FINDS THE POSITION OF THE ITEM IN THE ARRAY BY COMPARING ITEM NUMBERS AND RETURNS IT  VOID REMOVE_IT() – REMOVES THE ITEM FROM THE LIST. BOTH DEL() AND BUY() CALLS THIS FUNCTION  VOID SORT_LIST() – SORTS THE ITEMS IN THE LIST VOID ALL_IN() – WRITES ALL INFO INTO DATAFILE VOID ALL_OUT() – READS ALL INFO INTO PROGRAM 5: [1]
  • 13. PROGRAM CODE #include<fstream.h> #include<stdio.h> #include<string.h> #include<conio.h> #include<ctype.h> #include<dos.h> //SPACING TOOL OVERLOADED FUNCTIONS //For Strings: void Space(int n,char str[40],char sp=' ') { /* There is a fixed number of places(n), and after the string (str) is displayed, the remaining places are filled with spaces OR a char (sp). This allows the data to be shown more aligned. */ int i; cout.write(str,strlen(str)); int L=(n-strlen(str)); for(i=1; i<=L; i++) { cout<<sp; } } //For Unsigned Long: void Space(int n, unsigned long a) { /* Same concept as above BUT a different arrangement for Nos. From the fixed number of places(n), the number (a) is displayed at the end rather than the beginning as for strings. */ unsigned long i=a; int count=0; do { i=i/10; count++; } while(i>0); for(i=1; i<=(n-count); i++) putchar(' '); cout<<a; } 6: [1]
  • 14. PROGRAM CODE //For Integers. void Space(int n, int a) { int i=a; int count=0; do { i=i/10; count++; } while(i>0); for(i=1; i<=((n-count)); i++) putchar(' '); cout<<a; } 6: [2]
  • 15. PROGRAM CODE //GLOBAL MEMBERS int total; void count(); void ALL_IN(); void ALL_OUT(); //THE CLASS LIST STARTS HERE: class LIST { public: char itmNo[40]; char Name[40]; int Age; unsigned long Cost; char His[100]; LIST() { clrscr(); //Creation of datafile if program opened for first time: fstream f; f.open( "CB_LIST.DAT", ios::out | ios::noreplace ); f.close(); count(); ALL_IN(); } ~LIST() { ALL_OUT(); } void view(); //Displays the List in tabular form void viewHis(); //Displays List with History void Search(); //Search an item on List. void Buy(); //Deletes an item (Customer Option) void Sell(); /*Saves the details of the item to sell for consideration (Supplier Option) */ void DEL(); //Deletes an item (Manager Option) void ADD(); //Adds an item (Manager Option) void EDIT(); //Edits an existing item (Manager Option) private: void SORT_LIST(); //Sorts the items in the LIST acc to Item No. int Find_it(char [40]); //Finds the pos of item to delete w.r.t Item No. void Remove_it(char [40]); //Removes an item from the List }cb[200],ob; 6: [3]
  • 16. PROGRAM CODE //GLOBAL MEMBERS int stotal; void scount(); void sALL_IN(); void sALL_OUT(); // THE CLASS Sup STARTS HERE: class Sup { public: char Name[40]; int Age; unsigned long Cost; char His[100]; Sup() { //Creation of datafile if program opened for first time: fstream f; f.open( "CB_SALE.DAT", ios::out | ios::noreplace | ios::binary); f.close(); scount(); sALL_IN(); } ~Sup() { sALL_OUT(); } }s[20],sob,sob2; 6: [4]
  • 17. PROGRAM CODE //GLOBAL MEMBERS void PASS_IN(); void PASS_OUT(); void BAL_IN(); void BAL_OUT(); // THE CLASS MNGR STARTS HERE: unsigned long bal; //balance char pass[10]; //password class Mngr { public: unsigned long dw; //deposit or withdraw. Mngr() { //Creation of datafile if program opened for first time: fstream f; f.open( "CB_PASS.DAT", ios::out | ios::noreplace ); f.close(); fstream f2; f2.open( "CB_BAL.DAT", ios::out | ios::noreplace ); f2.close(); PASS_IN(); //Retrieves the password from a datafile BAL_IN(); //Retrieves the current store balance from a datafile } ~Mngr() { PASS_OUT(); //Sends the password into a datafile BAL_OUT(); //Sends the current store balance into a datafile } void PW(); //Function that changes the password void Cview(); //Function that shows Store Balance void Cdep(unsigned long); //Function that allows us to deposit money void Cwid(unsigned long); //Function that allows us to withdraw money void CCash(); // Function that opens the menu for CUBE CASHIER } m1; 6: [5]
  • 18. PROGRAM CODE // THE FUNCTIONS THAT WORK WITH DATA FILES. // Function count Finds No of Items in Store void count() { fstream f; f.open( "CB_LIST.DAT", ios::in | ios::binary ); int counter=0; while( ! f.eof() ) { f.read((char*)&sob, sizeof(LIST)); counter++; }; counter--; //since one record extra is always counted. f.close(); total=counter; } // Reads the data from the datafile and Stores the values intohe array objects. void ALL_IN() { fstream chew; chew.open( "CB_LIST.DAT", ios::in | ios::binary ); int i=0; while( i<total ) { chew.read((char*)&ob, sizeof(ob)); strcpy(cb[i].itmNo, ob.itmNo); strcpy(cb[i].Name, ob.Name); cb[i].Age=ob.Age; cb[i].Cost=ob.Cost; strcpy(cb[i].His, ob.His ); i++; }; chew.close(); } 6: [6]
  • 19. PROGRAM CODE // Writes the data from the array objects into the data file. void ALL_OUT() { fstream blow; blow.open( "CB_LIST.DAT", ios::out | ios::binary | ios::trunc ); int i=0; while( i<total ) { blow.write((char*)&cb[i], sizeof(LIST)); i++; }; blow.close(); } // Counts the no of Supplier offers for the manager to decide on later. void scount() { fstream f; f.open( "CB_SALE.DAT", ios::in | ios::binary ); int counter=0; while( ! f.eof() ) { f.read((char*)&sob2, sizeof(sob2)); counter++; }; counter--; //since one record extra is always counted. f.close(); stotal=counter; } 6: [7]
  • 20. PROGRAM CODE // Reads the data from the data file and Stores the values into the array objects. void sALL_IN() { fstream chew; chew.open( "CB_SALE.DAT", ios::in | ios::binary ); int i=0; while( i < stotal ) { chew.read((char*)&sob, sizeof(sob)); strcpy(s[i].Name, sob.Name); s[i].Age=sob.Age; s[i].Cost=sob.Cost; strcpy(s[i].His, sob.His ); i++; }; chew.close(); } // Writes the data from the array objects into the data file. void sALL_OUT() { fstream blow; blow.open( "CB_SALE.DAT", ios::out | ios::binary | ios::trunc ); int i=0; while( i< stotal ) { blow.write((char*)&s[i], sizeof(LIST)); i++; }; blow.close(); } 6: [8]
  • 21. PROGRAM CODE // Retrieves the store balance from the Data File. void BAL_IN() { fstream chew; chew.open( "CB_BAL.DAT", ios::in); chew>>bal; chew.close(); } // Stores the Store Balance into the Data File. void BAL_OUT() { fstream blow; blow.open( "CB_BAL.DAT", ios::out | ios::binary | ios::trunc ); blow<<bal; blow.close(); } // Retrieves the Password from the Data File. void PASS_IN() { fstream chew; chew.open( "CB_PASS.DAT", ios::in); chew>>pass; chew.close(); } // Stores the Password into the Data File. void PASS_OUT() { fstream blow; blow.open( "CB_PASS.DAT", ios::out | ios::binary | ios::trunc ); blow<<pass; blow.close(); } 6: [9]
  • 22. PROGRAM CODE // THE CLASS MNGR FUNCTIONS: void Mngr ::PW() { char Upass[10]; //user pass cout<<"n Please enter the new Password (10 char)n "; gets(Upass); cout<<"n Your Password has been Changed from”; cout<<“ " "<<pass<<" " to " "<<Upass<<" " .n"; strcpy(pass,Upass); } void Mngr ::Cview() { cout<<"n The Balance in your Account: "<<bal; cout<<endl; } void Mngr ::Cdep(unsigned long dep=-1) { if(dep==-1) //by manager { cout<<"n How much money to deposit into Account?n "; cin>>dw; cin.ignore(); bal+=dw; Cview(); } else { bal+=dep; } } void Mngr ::Cwid(unsigned long wid=-1) { if(wid==-1) //by manager { cout<<"n How much money to withdraw into Account?n "; cin>>dw; cin.ignore(); if( dw>bal ) { cout<<"n There is not enough money to withdraw."; } else {bal-=dw; } Cview(); } else { bal-=wid; } } 6: [10]
  • 23. PROGRAM CODE void Mngr::CCash() { int ch; char ok; cout<<"n Welcome to The Cube Cashier."; do { cout<<"n Choose Among The Options Below: nn 1. View Balancenn 2. Depositnn 3. Withdraw n "; cout<<"n Your Choice (1-3) :"; cin>>ch; cin.ignore(); cout<<endl; switch(ch) { case 1: Cview(); break; case 2: Cdep(); break; case 3: Cwid(); break; default: cout<<"n Invalid Option."; } cout<<"n Exit Cube Cashier? (Y/N) :"; cin.get(ok); cout<<endl; }while(ok=='n' || ok=='N'); } 6: [11]
  • 24. PROGRAM CODE // THE CLASS LIST FUNCTIONS: void LIST::view() { SORT_LIST(); Space(33,"_",'_'); Space(41,"THE LIST",'_'); cout<<endl; Space(12,"Item No | "); Space(42,"Name of Item"); Space(7,"| Age"); Space(12,"| Cost"); cout<<"|nn"; for(int j=0; j<total; j++) { Space(12,cb[j].itmNo); Space(42,cb[j].Name); Space(7,cb[j].Age); Space(12,cb[j].Cost); cout<<"nn"; if((j+1)%10==0 && j!=0 && total>10) { cout<<" See the next 10 items? (Y/N) : "; char ch; cin.get(ch); cout<<endl; if(ch=='y' || ch=='Y') continue; else break; } } //End of for loop. //Exception Handling if(total==0) { Space(22,""); Space(52,"<<<< NO ITEMS FOUND! >>>>"); cout<<endl<<endl; } Space(27,"_",'_'); Space(47,"[Enter To Continue]",'_'); cout<<endl; getch(); cout<<endl; } 6: [12]
  • 25. PROGRAM CODE void LIST::viewHis() { char temp[100]; SORT_LIST(); Space(31,"_",'_'); Space(43,"THE HISTORY",'_'); cout<<endl; Space(12,"Item No | "); Space(42,"Name of Item"); Space(7,"| Age"); Space(12,"| Cost"); cout<<"|nn"; for(int i=0; i<total; i++) { Space(12,cb[i].itmNo); Space(42,cb[i].Name); Space(7,cb[i].Age); Space(12,cb[i].Cost); cout<<"nn"; Space(12," | HISTORY: "); Space(57, cb[i].His ); cout<<endl; if( (i+1)!=total ) Space(74,"",'_'); cout<<"nn"; if( (i+1)%5==0 && i!=0 && total>5) { cout<<" See the next 5 items? (Y/N) : "; char ch; cin.get(ch); cout<<endl; if(ch=='y' || ch=='Y') { clrscr(); Space(31,"_",'_'); Space(43,"THE HISTORY",'_'); cout<<endl; Space(12,"Item No | "); Space(42,"Name of Item"); Space(7,"| Age"); Space(12,"| Cost"); cout<<"|nn"; continue; } else break; } //end of outer if loop } //end of for loop 6: [13]
  • 26. PROGRAM CODE //Exception Handling if(total==0) { Space(22,""); Space(52,"<<<< NO ITEMS FOUND! >>>>"); cout<<endl<<endl; } Space(27,"_",'_'); Space(47,"[Enter To Continue]",'_'); cout<<endl; getch(); cout<<endl; } void LIST::SORT_LIST() { char tempIN[40]; char tempName[40]; int tempAge; unsigned long tempCost; char tempHis[100]; int i; int flag=0; for(i=total; i>0; i--) { for(int j=0; j<i-1; j++) { //To Compare the Strings. for(int o=0; o<strlen(cb[j].itmNo); o++) { if(cb[j].itmNo[o]==cb[j+1].itmNo[o]) continue; else if(cb[j].itmNo[o]>cb[j+1].itmNo[o]) { flag=1; break; } else {flag=0; break;} } //inner most for loop. if(flag==1) { strcpy(tempIN,cb[j].itmNo); strcpy(c b[j].itmNo,cb[j+1].itmNo); strcpy(cb[j+1].itmNo,tempIN); strcpy(tempName,cb[j].Name); strcpy(cb[j].Name,cb[j+1].Name); strcpy(cb[j+1].Name,tempName); 6: [14]
  • 27. PROGRAM CODE tempAge=cb[j].Age; cb[j].Age=cb[j+1].Age; cb[j+1].Age=tempAge; tempCost=cb[j].Cost; cb[j].Cost=cb[j+1].Cost; cb[j+1].Cost=tempCost; strcpy(tempHis,cb[j].His); strcpy(cb[j].His,cb[j+1].His); strcpy(cb[j+1].His,tempHis); } //END OF COMPARING STRING (IF STATEMENT) } //END OF INNER FOR LOOP } //END OF OUTER FOR LOOP } void LIST::Search() { int i; char S[40]; char Su[40]; char Sl[40]; Space(33,"_",'_'); Space(41,"THE SEARCH",'_'); cout<<endl; cout<<"n Which entity to search in?"; cout<<"nn 1. Namenn 2. Agenn 3. Costnn 4. Historynn Your Choice (1-4) : "; int ch; cin>>ch; switch(ch) { case 1: cout<<"n Enter a Word to Search for: "; gets(S); //to remove the case sensitivity of a search. for(i=0; i<strlen(S); i++) { Su[i]=toupper(S[i]); Sl[i]=tolower(S[i]); } cout<<"n"; Space(30,"_",'_'); Space(44,"SEARCH RESULTS",'_'); cout<<endl; Space(12,"Item No | "); Space(42,"Name of Item"); Space(7,"| Age"); Space(12,"| Cost"); cout<<"|"; 6: [15]
  • 28. PROGRAM CODE cout<<"nn"; int count=0; //counts no of letters in each word int J=0; //a memory location for temporary positions. int flag=0; // Outer loop searches moves from item to item nof LIST for(i=0; i<total; i++) { //Making Last character of every String/Name an End of Word character // i.e <space> if( cb[i].Name[ (strlen(cb[i].Name)-1) ] !=' ' ) cb[i].Name[ (strlen(cb[i].Name)) ]=' '; // Inner loop compares word by word of an item NAME at a time for(int j=0; j< strlen( cb[i].Name ) ; j++) { J=j-1; if(cb[i].Name[j]==' ') continue; do //Finds total length of the word. { J++; count++; } while(cb[i].Name[J+1] != ' '); //outermost if if(count==strlen(S)) { //if the lengths of searched item and word are same. if( (cb[i].Name[j]==Su[0]) || (cb[i].Name[j]==Sl[0]) ) { // if the first character of both searched item and name is same // Innermost loop compares character by character from // the starting of each word in the Item Name. for(int o=0; o<count; o++) { if(cb[i].Name[j+o]==Su[o] || cb[i].Name[j+o]==Sl[o]) { // if the character of the searched word and word in the Item Name is same if(o==count-1) // if this is the last character { flag=1; Space(12,cb[i].itmNo); Space(42,cb[i].Name); Space(7,cb[i].Age); Space(12,cb[i].Cost); cout<<"nn"; }//end of innermost if 6: [16]
  • 29. PROGRAM CODE } // end of if statement that checks first character of both words else {break; } //end of 3rd inner if-else }//end of innermost for loop }//end of inner if loop }//outermost if //moves the counter ( j )of the loop that searches word by word to the next //word of item Name. j+=(count-1); count=0; } //inner for loop. } //outer loop. //Exception Handling if(flag==0) { Space(22,""); Space(52,"<<<< NO SUCH ITEM FOUND! >>>>"); cout<<endl<<endl; } Space(27,"_",'_'); Space(47,"[Enter To Continue]",'_'); getch(); break; 6: [17]
  • 30. PROGRAM CODE case 4: //The Search in the History of an item is the same //as the Search in the Name of the item cout<<"n Enter a Word to Search for: "; gets(S); //to remove the case sensitivity of a search. for(i=0; i<strlen(S); i++) { Su[i]=toupper(S[i]); Sl[i]=tolower(S[i]); } cout<<"n"; Space(30,"_",'_'); Space(44,"SEARCH RESULTS",'_'); cout<<endl; Space(12,"Item No | "); Space(42,"Name of Item"); Space(7,"| Age"); Space(12,"| Cost"); cout<<"|"; cout<<"nn"; count=0; //counts no of letters in each word J=0; //a memory location for temporary positions. flag=0; for(i=0; i<total; i++) { if( cb[i].His[ (strlen(cb[i].His)-1) ] !=' ' ) cb[i].His[ (strlen(cb[i].His)) ]=' '; for(int j=0; j< strlen( cb[i].His ) ; j++) { J=j-1; if(cb[i].His[j]==' ') continue; //Finds total length of the word. do { J++; count++; } while(cb[i].His[J+1] != ' '); //outermost if if(count==strlen(S)) { //if the lengths of searched item and word is same. if( (cb[i].His[j]==Su[0]) || (cb[i].His[j]==Sl[0]) ) 6: [18]
  • 31. PROGRAM CODE { for(int o=0; o<count; o++) { if(cb[i].His[j+o]==Su[o] || cb[i].His[j+o]==Sl[o]) { if(o==count-1) { flag=1; Space(12,cb[i].itmNo); Space(42,cb[i].Name); Space(7,cb[i].Age); Space(12,cb[i].Cost); cout<<"n"; Space(12," | "); Space(10, "History: "); cout<<"n"; Space(12," | "); Space(70, cb[i].His); cout<<"... "; cout<<"nnn"; } //end of 4th inner if } else { break; } }//end of innermost for loop }//end of if loop } //outermost if j+=(count-1); count=0; } //inner for loop. } //outer loop. if(flag==0) { Space(22,""); Space(52,"<<<< NO SUCH ITEM FOUND! >>>>"); cout<<endl<<endl; } Space(27,"_",'_'); Space(47,"[Enter To Continue]",'_'); getch(); break; 6: [19]
  • 32. PROGRAM CODE case 2: //Search in Age of Item unsigned long U,L; //upper limit, lower limit flag=0; cout<<"n Enter the Upper Limit and Lower Limit. (Both Included in Search.)n"; cout<<"n ttt Lower Limit: "; cin>>L; cout<<" ttt Upper Limit: "; cin>>U; cout<<"nn ttt [ "<<L<<" <--> "<<U<<" ]"; cout<<endl; cout<<"n"; Space(30,"_",'_'); Space(44,"SEARCH RESULTS",'_'); cout<<endl; Space(12,"Item No | "); Space(42,"Name of Item"); Space(7,"| Age"); Space(12,"| Cost"); cout<<"|"; cout<<"nn"; for(i=0; i<total; i++) { if( cb[i].Age >=L && cb[i].Age <=U ) { flag=1; Space(12,cb[i].itmNo); Space(42,cb[i].Name); Space(7,cb[i].Age); Space(12,cb[i].Cost); cout<<"nn"; } } //EXCEPTION HANDLING: if(flag==0) { Space(22,""); Space(52,"<<<< NO SUCH ITEM FOUND! >>>>"); cout<<endl<<endl; } Space(27,"_",'_'); Space(47,"[Enter To Continue]",'_'); getch(); break; 6: [20]
  • 33. PROGRAM CODE case 3: //Search in Cost // It is the same as the search in age, //except for the fact that Cost is an unsigned long datatype, //and Age is an integer datatype flag=0; cout<<"n Enter the Upper Limit and Lower Limit. (Both Included in Search.)n"; cout<<"n ttt Lower Limit: "; cin>>L; cout<<" ttt Upper Limit: "; cin>>U; cout<<"nn ttt [ "<<L<<" <--> "<<U<<" ]"; cout<<endl; cout<<"n"; Space(30,"_",'_'); Space(44,"SEARCH RESULTS",'_'); cout<<endl; Space(12,"Item No | "); Space(42,"Name of Item"); Space(7,"| Age"); Space(12,"| Cost"); cout<<"|"; cout<<"nn"; for(i=0; i<total; i++) { if( cb[i].Cost >=L && cb[i].Cost <=U ) { flag=1; Space(12,cb[i].itmNo); Space(42,cb[i].Name); Space(7,cb[i].Age); Space(12,cb[i].Cost); cout<<"nn"; } } if(flag==0) { Space(22,""); Space(52,"<<<< NO SUCH ITEM FOUND! >>>>"); cout<<endl<<endl; } Space(27,"_",'_'); Space(47,"[Enter To Continue]",'_'); getch(); break; default: cout<<"Invalid Choice. "<<'n'; } //end of switch case } // End of Search() 6: [21]
  • 34. PROGRAM CODE int LIST::Find_it(char chk[40]) { int pos=-5; //String Comparism for(int i=0; i<total; i++) { if(chk[0]==cb[i].itmNo[0]) { for(int j=0; j<strlen(cb[i].itmNo); j++) { if(chk[j]==cb[i].itmNo[j]) { if(j==strlen(cb[i].itmNo)-1) pos=i; } else { break; } } } } return pos; } void LIST::Remove_it(char chk[40]) { int pos=Find_it(chk); //Deleting the items at position pos: for(int i=pos; i<total-1; i++) { strcpy(cb[i].itmNo,cb[i+1].itmNo); strcpy(cb[i].Name, cb[i+1].Name); cb[i].Age=cb[i+1].Age; cb[i].Cost=cb[i+1].Cost; } total--; } 6: [22]
  • 35. PROGRAM CODE void LIST::DEL() { char chk[40]; char ok='n'; do { cout<<" Enter the item number of the item you wish to delete.n "; gets(chk); int pos=Find_it(chk); if(pos==-5) //Error Handling { cout<<" No such Item Number. n You may have typed it Wrong."<<'n'; cout<<"nn Try again (y/n) ?n "; cin.get(ok); cin.ignore(); //Buffer error removed. cout<<"n"; } else { Remove_it(chk); cout<<"nn The Item has been deleted.nn"; ok='n'; } } while(ok=='y' || ok=='Y'); char ok2='n'; cout<<" Would you like to see THE LIST? (Y/N) n "; cin.get(ok2); if(ok2=='y' || ok2=='Y') { cout<<"nn"; view(); } } 6: [23]
  • 36. PROGRAM CODE void LIST::Buy() { char ok='n'; int pos[5]; int count=-1; char chk[5][40]; char bought='n'; do {count++; cout<<" Enter the item number of the item you wish to buyn "; gets(chk[count]); //Error Handling : You can not buy same item twice. int ok3=0; for(int i=0; i<count; i++) { if(strcmp(chk[count],chk[i])==0) ok3=1; } if(ok3==1) {cout<<"n You cannot buy the same item twice! nn"; count--; continue; } //END OF ERROR HANDLING. pos[count]=Find_it(chk[count]); //Error Handling: Wrong Item Number Entered. if(pos[count]==-5) { cout<<"n INVALID Item Number. Try Again. (y/n) n "; count--; ok='n'; } //To allow users to buy more than one item. max 5. else { bought='y'; cout<<"n Buy Another item? (y/n) [MAX: 5 items per Bill] n "; } cin.get(ok); cout<<endl; cin.ignore(); //Buffer error } while(ok=='y' || ok=='Y'); if(bought=='y') { Space(20,"_",'_'); Space(30,"BILL",'_'); cout<<endl; Space(40,"| Name"); 6: [24]
  • 37. PROGRAM CODE Space(1 0,"| Cost"); cout<<endl; unsigned long totalcost=0; for(int i=0; i<=count; i++) { Space(40,cb[pos[i]].Name); Space(10,cb[pos[i]].Cost); totalcost+=cb[pos[i]].Cost; cout<<endl; } Space(20,"_",'_'); Space(30,"_",'_'); cout<<endl; Space(40," TOTAL: "); Space(10,totalcost); cout<<"nn Thank you for shopping at This Antique Store. n"; for(i=0; i<=count; i++) { Remove_it(cb[pos[i]].itmNo); } bal+=totalcost; //increasing store balance. } else { cout<<"n Hope you find something of interest next time."; } } 6: [25]
  • 38. PROGRAM CODE void LIST::EDIT() { char chk[40]; cout<<" Enter the Item No of the Item to Editn "; gets(chk); int pos=Find_it(chk); if(pos==-5) cout<<"n Invalid Item No."; else { char ok='n'; do { cout<<"n Which entity do you want to edit?"; cout<<"nn 1. Namenn 2. Agenn 3. Costnn 4. Historynn Your Choice (1-4) : "; int ch; cin>>ch; cin.ignore(); switch(ch) { case 1: cout<<"n Enter the new Name: "; char name[40]; gets(name); strcpy(cb[pos].Name,name); break; case 2: cout<<"n Enter the new Age: "; int age; cin>>age; cb[pos].Age=age; break; case 3: cout<<"n Enter the new Cost: "; unsigned long cost; cin>>cost; cb[pos].Cost=cost; break; case 4: cout<<"n Enter the new History:n "; char his[100]; gets(his); strcpy(c b[pos].His , his); break; default: cout<<" INVALID CHOICE. n"; } cin.ignore(); cout<<" nn Any more EDITs on this item? (Y/N) : "; cin.get(ok); } while(ok=='y' || ok=='Y'); cout<<" n Your EDITING has been successful! "; } 6: [26]
  • 39. PROGRAM CODE } // END OF EDIT() void LIST::ADD() { cout<<"n TO ADD AN ITEM TO THE STORE.nn 1. From Suppliernn 2. From Manager.nn "; cout<<"Your Choice (1-2) : "; int chk; cin>>chk; int i; switch(chk) { case 1: if( stotal > 0 ) { for(i=0; i<stotal; i++) { cout<<"n Item #"<<(i+1); cout<<"n Name of Item : "<<s[i].Name; cout<<"n Age of Item : "<<s[i].Age; cout<<"n Asked Price : "<<s[i].Cost; cout<<"n History : "<<s[i].His; cout<<"nn ACCEPT OR DECLINE? (A/D): "; char ch2; cin>>ch2; cout<<endl; if(ch2=='a' || ch2=='A') { for(int j=0; j<1; j++) { cout<<" Enter the Item No of new Item:n "; gets(cb[total].itmNo); //ERROR HANDLING. ITEM NO MUST BE UNIQUE. if(Find_it(cb[total].itmNo)!=-5) //if item number as such exists { cout<<" Entered Item Number Already Exists. RETRY! nn"; j--; continue; } //END OF ERROR HANDLING. } //END of inner FOR LOOP cout<<"n Enter the new Item's Price:n "; cin>>cb[total].Cost; m1.Cwid(s[i].Cost); //removing asked price by supplier from the store balance. strcpy( cb[total].Name,s[i].Name ); 6: [27]
  • 40. PROGRAM CODE cb[total].Age=s[i].Age; strcpy( cb[total].His,s[i].His ); total++; } else if(ch2=='d' || ch2=='D') { cout<<" Item is Declined.n"; } if( (i+1) == stotal ) { cout<<"n No More Items By Supplier.n"; //clearing the CB_SALE.dat fstream f; f.open("CB_SALE.DAT", ios::out | ios::trunc ); f.close(); //end of clearing } } //end of for loop. //Deleting items from the Supplier Waiting List. stotal=0; } else { cout<<"n No Items by Supplier n"; } break; case 2: cout<<"n How many items to add? : "; int noi; cin>>noi; //no of items to sell cout<<endl; for(i=0; i<noi; i++) { cout<<"n Item To Add ("<<(i+1)<<"/"<<noi<<")nn"; cout<<" Enter the Item No of new Item : "; gets(cb[total].itmNo); //ERROR HANDLING. ITEM NO MUST BE UNIQUE. if(Find_it(cb[total].itmNo)!=-5) //if itm number as such exists {cout<<"n Entered Item Number Already Exists. RETRY! nn"; i--; continue; } //END OF ERROR HANDLING. cout<<"n Enter the Name of the Item : "; gets(cb[total].Name); cout<<"n Enter the Age of the Item : "; cin>>cb[total].Age; cout<<"n Enter the Item's Price : "; cin>>cb[total].Cost; cout<<"n Enter the Item's History : "; gets(cb[total].His); total++; } 6: [28]
  • 41. PROGRAM CODE break; default: cout<<"n Invalid Choice."; } //End of Switch Case char ok='n'; cin.ignore(); cout<<"n Would you like to see THE LIST? (Y/N) : "; cin.get(ok); cin.ignore(); if(ok=='y' || ok=='Y') { cout<<"nn"; view(); } } void LIST::Sell() { cout<<"n Welcome Supplier.n How many items to sell?n "; int noi; cin>>noi; //no of items to sell cout<<endl; for(int i=0; i<noi; i++) { cout<<"n Item To Sell No:"<<(i+1)<<"nn"; cout<<" Enter the Name of the Item: "; gets(s[stotal].Name); cout<<"n Enter the Age of the Item: "; cin>>s[stotal].Age; cout<<"n Enter your Selling Price: "; cin>>s[stotal].Cost; cout<<"n Enter Item's History: "; gets(s[stotal].His); stotal++; } cout<<"n Thank you for your offer. n"; } 6: [29]
  • 42. PROGRAM CODE // THE VOID MAIN FUNCTION: void main() { int ch; do { clrscr(); Space(74,"",'_'); cout<<endl; Space(33,"",'_'); Space(41,"MAIN MENU",'_'); cout<<endl; Space(25,"n 1. THE LIST"); Space(28," | Shows the List of items on Sale."); cout<<endl; Space(25,"n 2. THE HISTORY"); Space(28," | Learn more about an Item or Store"); cout<<endl; Space(25,"n 3. THE SEARCH "); Space(28," | Can't Find what you're looking for?",' '); cout<<endl; Space(25,"n 4. I AM A CUSTOMER"); Space(28," | Buy something nice for Yourself."); cout<<endl; Space(25,"n 5. I AM A SUPPLIER"); Space(28," | Sell us something We may like."); cout<<endl; Space(25,"n 6. I AM THE MANAGER"); Space(28," | A Password Protected Control Centre. "); cout<<endl; Space(25,"n 0. EXIT."); Space(28," | Done here? Leave the Online Store."); cout<<endl; Space(74,"",'_'); cout<<"nn Your Choice (0-6): "; cin>>ch; cin.ignore(); cout<<endl; clrscr(); switch(ch) { case 1: ob.view(); break; case 2: ob.viewHis(); break; case 3: ob.Search(); break; 6: [30]
  • 43. PROGRAM CODE case 4: cout<<endl; Space(30,"_",'_'); Space(44,"I AM A CUSTOMER",'_'); cout<<endl; cout<<endl; ob.Buy(); cout<<endl; Space(27,"_",'_'); Space(47,"[Enter To Continue]",'_'); getch(); break; case 5: cout<<endl; Space(30,"_",'_'); Space(44,"I AM A SUPPLIER",'_'); cout<<endl; cout<<endl; ob.Sell(); cout<<endl; Space(27,"_",'_'); Space(47,"[Enter To Continue]",'_'); getch(); break; case 6: int ch2; cout<<" Enter the Password: n "; char ps[10]; gets(ps); if(strcmp(ps,pass)==0) { cout<<"n Welcome Back Manager.nn"; do { clrscr(); cout<<endl; Space(29,"_",'_'); Space(45,"I AM THE MANAGER",'_'); cout<<endl; cout<<endl; Space(33,"n 1. CHANGE THE PASSWORD "); Space(20," | Be Safe & Secure. "); cout<<endl; Space(33,"n 2. ADD AN ITEM TO THE LIST "); Space(20," | More items to add? "); cout<<endl; Space(33,"n 3. EDIT AN ITEM ON THE LIST "); Space(20," | Make some Changes. ",' '); cout<<endl; Space(33,"n 4. DELETE AN ITEM FROM THE LIST"); 6: [31]
  • 44. PROGRAM CODE Space(20," | Remove the Unwanted."); cout<<endl; Space(33,"n 5. USE THE CUBE CASHIER "); Space(20," | Check. Deposit. Withdraw."); cout<<endl; Space(33,"n 0. EXIT."); Space(20," | Done? Log out Safely."); cout<<endl; Space(74,"",'_'); cout<<"nn Your Choice (0-5): "; cin>>ch2; cin.ignore(); cout<<endl; clrscr(); cout<<endl; Space(29,"_",'_'); Space(45,"I AM THE MANAGER",'_'); cout<<endl; cout<<endl; switch(ch2) { case 1: m1.PW(); break; case 2: ob.ADD(); break; case 3: ob.EDIT(); cout<<endl; Space(27,"_",'_'); Space(47,"[Enter To Continue]",'_'); getch(); break; case 4: ob.DEL(); break; case 5: m1.CCash(); break; case 0: cout<<"n Thank you & Goodbye Manager! You Have been logged out Safely. n"; cout<<endl; Space(2 7,"_",'_'); Space(47,"[Enter To Continue]",'_'); getch(); break; default: cout<<"n INVALID CHOICE! RETRY! n"; } } while(ch2!=0); 6: [32]
  • 45. PROGRAM CODE } else { cout<<"n Wrong Password!n "; getch(); } break; default: cout<<"nn Thank you For Visitng & Come Again Soon! "; } }while(ch!=0); getch(); } 6: [33]
  • 46. SAMPLE INPUT & OUTPUT __________________________________________________________________________ _________________________________MAIN MENU________________________________ 1. THE LIST | Shows the List of items on Sale. 2. THE HISTORY | Learn more about an Item or Store 3. THE SEARCH | Can't Find what you're looking for? 4. I AM A CUSTOMER | Buy something nice for Yourself. 5. I AM A SUPPLIER | Sell us something We may like. 6. I AM THE MANAGER | A Password Protected Control Centre. 0. EXIT. | Done here? Leave the Online Store. __________________________________________________________________________ Your Choice (0-6): 1 _________________________________THE LIST_________________________________ Item No | Name of Item | Age| Cost| #23022 Compass of Peter Tsar The Terrible 140 7000000 #23023 Gustave's Blueprints 120 6000000 #23032 Hitler's Globe 76 3800000 #23033 Karl's Ink Pen 125 6250000 #23058 Katana of Shogan Tokugawa 414 20700000 #23059 Mahatma Gandhi's Spectacles 62 3100000 #23067 Red Barron's Remains 96 4800000 #23076 Silver Claws Of Maharana 74 3700000 #23077 Stallon's Lost Diary 76 3800000 #23081 Sword of Tipu Sultan 87 4350000 See the next 10 items? (Y/N) : Y #23091 The Pharaoh's Sceptre 124 6200000 #23096 Viking's Sledgehammer 168 8400000 ___________________________[Enter To Continue]____________________________ 7: [1]
  • 47. SAMPLE INPUT & OUTPUT __________________________________________________________________________ _________________________________MAIN MENU________________________________ 1. THE LIST | Shows the List of items on Sale. 2. THE HISTORY | Learn more about an Item or Store 3. THE SEARCH | Can't Find what you're looking for? 4. I AM A CUSTOMER | Buy something nice for Yourself. 5. I AM A SUPPLIER | Sell us something We may like. 6. I AM THE MANAGER | A Password Protected Control Centre. 0. EXIT. | Done here? Leave the Online Store. __________________________________________________________________________ Your Choice (0-6): 2 _______________________________THE HISTORY________________________________ Item No | Name of Item | Age| Cost| #23022 Compass of Peter Tsar The Terrible 140 7000000 | HISTORY: The compass used by the famous conqueror __________________________________________________________________________ #23023 Gustave's Blueprints 120 6000000 | HISTORY: The original blueprints of the Eiffel Tower __________________________________________________________________________ #23032 Hitler's Globe 76 3800000 | HISTORY: The globe he used to strategize his conquests __________________________________________________________________________ #23033 Karl's Ink Pen 125 6250000 | HISTORY: He wrote the Communist Manifesto with this pen __________________________________________________________________________ #23058 Katana of Shogan Tokugawa 414 20700000 | HISTORY: The sword of the first Shogun of the Tokugawa clan __________________________________________________________________________ See the next 5 items? (Y/N) : Y _______________________________THE HISTORY________________________________ Item No | Name of Item | Age| Cost| #23059 Mahatma Gandhi's Spectacles 62 3100000 | HISTORY: See the world through the eyes of this reputed freedom fighter __________________________________________________________________________ #23067 Red Barron's Remains 96 4800000 | HISTORY: The famous fighter plane from World War 1 __________________________________________________________________________ #23076 Silver Claws Of Maharana 74 3700000 | HISTORY: The weapon he was most skilled in __________________________________________________________________________ #23077 Stallon's Lost Diary 76 3800000 | HISTORY: The journal where he wrote his strategies and plans __________________________________________________________________________ #23081 Sword of Tipu Sultan 87 4350000 | HISTORY: The sword he held before he met his death 7: [2]
  • 48. SAMPLE INPUT & OUTPUT __________________________________________________________________________ See the next 5 items? (Y/N) : Y _______________________________THE HISTORY________________________________ Item No | Name of Item | Age| Cost| #23091 The Pharaoh's Sceptre 124 6200000 | HISTORY: An Egyptian artefact that was a symbol of authority __________________________________________________________________________ #23096 Viking's Sledgehammer 168 8400000 | HISTORY: A weapon of great power used by the Vikings ___________________________[Enter To Continue]____________________________ 7: [3]
  • 49. SAMPLE INPUT & OUTPUT __________________________________________________________________________ _________________________________MAIN MENU________________________________ 1. THE LIST | Shows the List of items on Sale. 2. THE HISTORY | Learn more about an Item or Store 3. THE SEARCH | Can't Find what you're looking for? 4. I AM A CUSTOMER | Buy something nice for Yourself. 5. I AM A SUPPLIER | Sell us something We may like. 6. I AM THE MANAGER | A Password Protected Control Centre. 0. EXIT. | Done here? Leave the Online Store. __________________________________________________________________________ Your Choice (0-6): 3 _________________________________THE SEARCH_______________________________ Which entity to search in? 1. Name 2. Age 3. Cost 4. History Your Choice (1-4) : 1 Enter a Word to Search for: gLoBe ______________________________SEARCH RESULTS______________________________ Item No | Name of Item | Age| Cost| #23032 Hitler's Globe 76 3800000 ___________________________[Enter To Continue]____________________________ _________________________________THE SEARCH_______________________________ Which entity to search in? 1. Name 2. Age 3. Cost 4. History Your Choice (1-4) : 3 Enter the Upper Limit and Lower Limit. (Both Included in Search.) Lower Limit: 0 Upper Limit: 1000000 [ 0 <--> 1000000 ] ______________________________SEARCH RESULTS______________________________ Item No | Name of Item | Age| Cost| <<<< NO SUCH ITEM FOUND! >>>> ___________________________[Enter To Continue]____________________________ 7: [4]
  • 50. SAMPLE INPUT & OUTPUT _________________________________THE SEARCH_______________________________ Which entity to search in? 1. Name 2. Age 3. Cost 4. History Your Choice (1-4) : 2 Enter the Upper Limit and Lower Limit. (Both Included in Search.) Lower Limit: 100 Upper Limit: 200 [ 100 <--> 200 ] ______________________________SEARCH RESULTS______________________________ Item No | Name of Item | Age| Cost| #23022 Compass of Peter Tsar The Terrible 140 7000000 #23023 Gustave's Blueprints 120 6000000 #23033 Karl's Ink Pen 125 6250000 #23091 The Pharaoh's Sceptre 124 6200000 #23096 Viking's Sledgehammer 168 8400000 ___________________________[Enter To Continue]____________________________ _________________________________THE SEARCH_______________________________ Which entity to search in? 1. Name 2. Age 3. Cost 4. History Your Choice (1-4) : 4 Enter a Word to Search for: fighter ______________________________SEARCH RESULTS______________________________ Item No | Name of Item | Age| Cost| #23059 Mahatma Gandhi's Spectacles 62 3100000 | History: | See the world through the eyes of this reputed freedom fighter ... #23067 Red Barron's Remains 96 4800000 | History: | The famous fighter plane from World War 1 ... ___________________________[Enter To Continue]____________________________ 7: [5]
  • 51. SAMPLE INPUT & OUTPUT __________________________________________________________________________ _________________________________MAIN MENU________________________________ 1. THE LIST | Shows the List of items on Sale. 2. THE HISTORY | Learn more about an Item or Store 3. THE SEARCH | Can't Find what you're looking for? 4. I AM A CUSTOMER | Buy something nice for Yourself. 5. I AM A SUPPLIER | Sell us something We may like. 6. I AM THE MANAGER | A Password Protected Control Centre. 0. EXIT. | Done here? Leave the Online Store. __________________________________________________________________________ Your Choice (0-6): 4 ______________________________I AM A CUSTOMER_____________________________ Enter the item number of the item you wish to buy #23033 Buy Another item? (y/n) [MAX: 5 items per Bill] Y Enter the item number of the item you wish to buy #23081 Buy Another item? (y/n) [MAX: 5 items per Bill] N ____________________BILL__________________________ | Name | Cost Karl's Ink Pen 6250000 Sword of Tipu Sultan 4350000 __________________________________________________ TOTAL: 10600000 Thank you for shopping at This Antique Store. ___________________________[Enter To Continue]____________________________ 7: [6]
  • 52. SAMPLE INPUT & OUTPUT __________________________________________________________________________ _________________________________MAIN MENU________________________________ 1. THE LIST | Shows the List of items on Sale. 2. THE HISTORY | Learn more about an Item or Store 3. THE SEARCH | Can't Find what you're looking for? 4. I AM A CUSTOMER | Buy something nice for Yourself. 5. I AM A SUPPLIER | Sell us something We may like. 6. I AM THE MANAGER | A Password Protected Control Centre. 0. EXIT. | Done here? Leave the Online Store. __________________________________________________________________________ Your Choice (0-6): 1 _________________________________THE LIST_________________________________ Item No | Name of Item | Age| Cost| #23022 Compass of Peter Tsar The Terrible 140 7000000 #23023 Gustave's Blueprints 120 6000000 #23032 Hitler's Globe 76 3800000 #23058 Katana of Shogan Tokugawa 414 20700000 #23059 Mahatma Gandhi's Spectacles 62 3100000 #23067 Red Barron's Remains 96 4800000 #23076 Silver Claws Of Maharana 74 3700000 #23077 Stallon's Lost Diary 76 3800000 #23091 The Pharaoh's Sceptre 124 6200000 #23096 Viking's Sledgehammer 168 8400000 ___________________________[Enter To Continue]____________________________ 7: [7]
  • 53. SAMPLE INPUT & OUTPUT _________________________________MAIN MENU________________________________ 1. THE LIST | Shows the List of items on Sale. 2. THE HISTORY | Learn more about an Item or Store 3. THE SEARCH | Can't Find what you're looking for? 4. I AM A CUSTOMER | Buy something nice for Yourself. 5. I AM A SUPPLIER | Sell us something We may like. 6. I AM THE MANAGER | A Password Protected Control Centre. 0. EXIT. | Done here? Leave the Online Store. __________________________________________________________________________ Your Choice (0-6): 5 ______________________________I AM A SUPPLIER_____________________________ Welcome Supplier. How many items to sell? 2 Item To Sell No:1 Enter the Name of the Item: The Orb of Galactus Enter the Age of the Item: 68 Enter your Selling Price: 5000000 Enter Item's History: The power of the cosmos trapped in an orb Item To Sell No:2 Enter the Name of the Item: The Toothpick of Gibralter Enter the Age of the Item: 45 Enter your Selling Price: 5600000 Enter Item's History: It still holds the piece of lettuce he pulled out Thank you for your offer. ___________________________[Enter To Continue]____________________________ 7: [8]
  • 54. SAMPLE INPUT & OUTPUT __________________________________________________________________________ _________________________________MAIN MENU________________________________ 1. THE LIST | Shows the List of items on Sale. 2. THE HISTORY | Learn more about an Item or Store 3. THE SEARCH | Can't Find what you're looking for? 4. I AM A CUSTOMER | Buy something nice for Yourself. 5. I AM A SUPPLIER | Sell us something We may like. 6. I AM THE MANAGER | A Password Protected Control Centre. 0. EXIT. | Done here? Leave the Online Store. __________________________________________________________________________ Your Choice (0-6): 6 Enter the Password: Hamburger _____________________________I AM THE MANAGER_____________________________ 1. CHANGE THE PASSWORD | Be Safe & Secure. 2. ADD AN ITEM TO THE LIST | More items to add? 3. EDIT AN ITEM ON THE LIST | Make some Changes. 4. DELETE AN ITEM FROM THE LIST | Remove the Unwanted. 5. USE THE CUBE CASHIER | Check. Deposit. Withdraw. 0. EXIT. | Done? Log out Safely. __________________________________________________________________________ Your Choice (0-5): 1 _____________________________I AM THE MANAGER_____________________________ Please enter the new Password (10 char) pass Your Password has been Changed from " Hamburger " to " pass " . ___________________________[Enter To Continue]____________________________ 7: [9]
  • 55. SAMPLE INPUT & OUTPUT _____________________________I AM THE MANAGER_____________________________ 1. CHANGE THE PASSWORD | Be Safe & Secure. 2. ADD AN ITEM TO THE LIST | More items to add? 3. EDIT AN ITEM ON THE LIST | Make some Changes. 4. DELETE AN ITEM FROM THE LIST | Remove the Unwanted. 5. USE THE CUBE CASHIER | Check. Deposit. Withdraw. 0. EXIT. | Done? Log out Safely. __________________________________________________________________________ Your Choice (0-5): 2 _____________________________I AM THE MANAGER_____________________________ TO ADD AN ITEM TO THE STORE. 1. From Supplier 2. From Manager. Your Choice (1-2) : 1 Item #1 Name of Item : The Orb of Galactus Age of Item : 68 Asked Price : 5000000 History : The power of the cosmos trapped in an orb ACCEPT OR DECLINE? (A/D): D Item is Declined. Item #2 Name of Item : The Toothpick of Gibralter Age of Item : 45 Asked Price : 5600000 History : It still holds the piece of lettuce he pulled out ACCEPT OR DECLINE? (A/D): A Enter the Item No of new Item: #23077 Entered Item Number Already Exists. RETRY! Enter the Item No of new Item: #23078 Enter the new Item's Price: 7000000 No More Items By Supplier. Would you like to see THE LIST? (Y/N) : Y 7: [10]
  • 56. SAMPLE INPUT & OUTPUT _________________________________THE LIST_________________________________ Item No | Name of Item | Age| Cost| #23022 Compass of Peter Tsar The Terrible 140 7000000 #23023 Gustave's Blueprints 120 6000000 #23032 Hitler's Globe 76 3800000 #23058 Katana of Shogan Tokugawa 414 20700000 #23059 Mahatma Gandhi's Spectacles 62 3100000 #23067 Red Barron's Remains 96 4800000 #23076 Silver Claws Of Maharana 74 3700000 #23077 Stallon's Lost Diary 76 3800000 #23078 The Toothpick of Gibralter 45 7000000 #23091 The Pharaoh's Sceptre 124 6200000 See the next 10 items? (Y/N) : N ___________________________[Enter To Continue]____________________________ _____________________________I AM THE MANAGER_____________________________ TO ADD AN ITEM TO THE STORE. 1. From Supplier 2. From Manager. Your Choice (1-2) : 2 How many items to add? : 2 Item To Add (1/2) Enter the Item No of new Item : #23001 Enter the Name of the Item : Boomerang of Alura Enter the Age of the Item : 89 Enter the Item's Price : 6900000 Enter the Item's History : Weapon used by Alura for hunt and battle Item To Add (2/2) Enter the Item No of new Item : #23004 Enter the Name of the Item : Book of Odis Enter the Age of the Item : 550 Enter the Item's Price : 8000000 Enter the Item's History : The book of spells according to Norse Mythology Would you like to see THE LIST? (Y/N) : Y 7: [11]
  • 57. SAMPLE INPUT & OUTPUT _________________________________THE LIST_________________________________ Item No | Name of Item | Age| Cost| #23001 Boomerang of Alura 89 6900000 #23004 Book of Odis 550 8000000 #23022 Compass of Peter Tsar The Terrible 140 7000000 #23023 Gustave's Blueprints 120 6000000 #23032 Hitler's Globe 76 3800000 #23058 Katana of Shogan Tokugawa 414 20700000 #23059 Mahatma Gandhi's Spectacles 62 3100000 #23067 Red Barron's Remains 96 4800000 #23076 Silver Claws Of Maharana 74 3700000 #23077 Stallon's Lost Diary 76 3800000 See the next 10 items? (Y/N) : Y #23078 The Toothpick of Gibralter 45 7000000 #23091 The Pharaoh's Sceptre 124 6200000 #23096 Viking's Sledgehammer 168 8400000 ___________________________[Enter To Continue]____________________________ 7: [12]
  • 58. SAMPLE INPUT & OUTPUT _____________________________I AM THE MANAGER_____________________________ 1. CHANGE THE PASSWORD | Be Safe & Secure. 2. ADD AN ITEM TO THE LIST | More items to add? 3. EDIT AN ITEM ON THE LIST | Make some Changes. 4. DELETE AN ITEM FROM THE LIST | Remove the Unwanted. 5. USE THE CUBE CASHIER | Check. Deposit. Withdraw. 0. EXIT. | Done? Log out Safely. __________________________________________________________________________ Your Choice (0-5): 3 _____________________________I AM THE MANAGER_____________________________ Enter the Item No of the Item to Edit #23032 Which entity do you want to edit? 1. Name 2. Age 3. Cost 4. History Your Choice (1-4) : 1 Enter the new Name: Globe of Adolf Hitler Any more EDITs on this item? (Y/N) : Y Which entity do you want to edit? 1. Name 2. Age 3. Cost 4. History Your Choice (1-4) : 2 Enter the new Age: 81 Any more EDITs on this item? (Y/N) : N Your EDITING has been successful! Would you like to see THE LIST? (Y/N) Y 7: [13]
  • 59. SAMPLE INPUT & OUTPUT _________________________________THE LIST_________________________________ Item No | Name of Item | Age| Cost| #23001 Boomerang of Alura 89 6900000 #23004 Book of Odis 550 8000000 #23022 Compass of Peter Tsar The Terrible 140 7000000 #23023 Gustave's Blueprints 120 6000000 #23032 Globe of Adolf Hitler 81 3800000 #23058 Katana of Shogan Tokugawa 414 20700000 #23059 Mahatma Gandhi's Spectacles 62 3100000 #23067 Red Barron's Remains 96 4800000 #23076 Silver Claws Of Maharana 74 3700000 #23077 Stallon's Lost Diary 76 3800000 See the next 10 items? (Y/N) : N ___________________________[Enter To Continue]____________________________ _____________________________I AM THE MANAGER_____________________________ 7: [14]
  • 60. SAMPLE INPUT & OUTPUT 1. CHANGE THE PASSWORD | Be Safe & Secure. 2. ADD AN ITEM TO THE LIST | More items to add? 3. EDIT AN ITEM ON THE LIST | Make some Changes. 4. DELETE AN ITEM FROM THE LIST | Remove the Unwanted. 5. USE THE CUBE CASHIER | Check. Deposit. Withdraw. 0. EXIT. | Done? Log out Safely. __________________________________________________________________________ Your Choice (0-5): 4 _____________________________I AM THE MANAGER_____________________________ Enter the item number of the item you wish to delete. #23058 The Item has been deleted. Would you like to see THE LIST? (Y/N) Y _________________________________THE LIST_________________________________ Item No | Name of Item | Age| Cost| #23001 Boomerang of Alura 89 6900000 #23004 Book of Odis 550 8000000 #23022 Compass of Peter Tsar The Terrible 140 7000000 #23023 Gustave's Blueprints 120 6000000 #23032 Globe of Adolf Hitler 81 3800000 #23059 Mahatma Gandhi's Spectacles 62 3100000 #23067 Red Barron's Remains 96 4800000 #23076 Silver Claws Of Maharana 74 3700000 #23077 Stallon's Lost Diary 76 3800000 #23078 The Toothpick of Gibralter 45 7000000 See the next 10 items? (Y/N) : Y #23091 The Pharaoh's Sceptre 124 6200000 #23096 Viking's Sledgehammer 168 8400000 ___________________________[Enter To Continue]____________________________ 7: [15]
  • 61. SAMPLE INPUT & OUTPUT _____________________________I AM THE MANAGER_____________________________ 1. CHANGE THE PASSWORD | Be Safe & Secure. 2. ADD AN ITEM TO THE LIST | More items to add? 3. EDIT AN ITEM ON THE LIST | Make some Changes. 4. DELETE AN ITEM FROM THE LIST | Remove the Unwanted. 5. USE THE CUBE CASHIER | Check. Deposit. Withdraw. 0. EXIT. | Done? Log out Safely. __________________________________________________________________________ Your Choice (0-5): 5 _____________________________I AM THE MANAGER_____________________________ Welcome to The Cube Cashier. Choose Among The Options Below: 1. View Balance 2. Deposit 3. Withdraw Your Choice (1-3) :1 The Balance in your Account: 2437783003 Exit Cube Cashier? (Y/N) :N Choose Among The Options Below: 1. View Balance 2. Deposit 3. Withdraw Your Choice (1-3) :3 How much money to withdraw from Account? 7783003 The Balance in your Account: 2430000000 Exit Cube Cashier? (Y/N) : Y 7: [16]
  • 62. SAMPLE INPUT & OUTPUT _____________________________I AM THE MANAGER_____________________________ 1. CHANGE THE PASSWORD | Be Safe & Secure. 2. ADD AN ITEM TO THE LIST | More items to add? 3. EDIT AN ITEM ON THE LIST | Make some Changes. 4. DELETE AN ITEM FROM THE LIST | Remove the Unwanted. 5. USE THE CUBE CASHIER | Check. Deposit. Withdraw. 0. EXIT. | Done? Log out Safely. __________________________________________________________________________ Your Choice (0-5): 0 _____________________________I AM THE MANAGER_____________________________ Thank you & Goodbye Manager! You Have been logged out Safely. ___________________________[Enter To Continue]____________________________ __________________________________________________________________________ _________________________________MAIN MENU________________________________ 1. THE LIST | Shows the List of items on Sale. 2. THE HISTORY | Learn more about an Item or Store 3. THE SEARCH | Can't Find what you're looking for? 4. I AM A CUSTOMER | Buy something nice for Yourself. 5. I AM A SUPPLIER | Sell us something We may like. 6. I AM THE MANAGER | A Password Protected Control Centre. 0. EXIT. | Done here? Leave the Online Store. __________________________________________________________________________ Your Choice (0-6): 0 Thank you For Visiting & Come Again Soon! 7: [17]
  • 63. BIBLIOGRAPHY 1 COMPUTER SCIENCE WITH C++ SUMITA ARORA 2 HTTP://CPLUSPLUS.COM 3 HTTP://TDOCPP.CO.CC 8: [1]
  • 64. SCOPE FOR FUTURE EXPANSION There are a number of possibilities to make this software better. After learning the usage and application of graphics, I plan on further improving the interactive nature of the software. The menu would have clickable buttons rather than typed in choices and by introducing the mouse pointer, selection of those options would be far more convenient. I also intend on introducing selective functionality through user accounts. This would provide more options for suppliers and managers. A Supplier can make an account, send an offer and be updated on the manager’s decision as well. This would be possible only with user accounts where the supplier can be identified by their username. Also, if the store is run by more than one person and each person is assigned a specific task to play, user accounts will be able to divide the manager options accordingly. As of now, its functions are restricted to those of an Antique Store. I plan to generalize it so that it can be used in any type of store allowing the manager to choose which fields and options are most suitable for his store. The next thing would be to encrypt the data files. Presently, the files store the details of the items on sale, the balance of the store and the password to access the manager options. These can be easily accessed using a notepad in windows. To prevent this, the files should be encrypted so that those who do try to read the data will not be able to make sense of it, and making the files Read Only can prevent offenders from changing the information. Unfortunately, this software is mainly just recording changes in the store with transactions. With much further study, I can implement it in the real world. Rather than recording the money moving from one account to another, the software can be made to access the bank accounts and allow the transaction of actual money. 9: [1]
  • 65. NEIL MATHEW XII B 13 DON BOSCO SCHOOL