954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Advanced Cashier 2010

By anuragcoder on May 18th, 2010 10:22 am

This is a program that emulates a supermarket cashier. It includes Login and also
uses EncryPro for encrypting customer ID.

AC 2010 Main Page : code.google.com/p/advancedcashier2010
EncryPro : code.google.com/p/encrypro

//Beta
//
//

#include <iostream>
#include <string>
#include <stdio.h>
#include <conio.h>
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include <time.h>

#define UN "default"
#define PW "default"
char User[21], Pwd[21];
char date [9];

using namespace std;
      void MkAster();
      void PromScr();
      void mainkernel();
int main()
{
    menu:
         
        int c;
        cout << "                       WELCOME                    "<<endl;
        cout << "_____________ADVANCED CASHIER 2010 M3________________"<<endl;
        cout << "What do you want to do?"<<endl;
        cout << "--------------------------------------------------"<<endl;
        cout << "1.Login"<<endl;
        cout << "2.Exit"<<endl;
        cout << "3.About"<<endl;
        cout << "PLEASE READ THE ""README.txt"""<<endl;
        cout << "--------------------------------------------------"<<endl;
        cout << "Please Enter Choice                               "<<endl;
        cin  >> c;
        
        if(c == 1){
             system("cls");
             int att = 4;
             cout << "------------------------------------------------------------------------------------------------------------------------------\n"<<endl;
    	     printf("LoginSafe By: KBM & Envy Inc. \nDeveloped By Inanimate Studios.\nVersion 2.1.2.\n\nPlease enter the following...\n");
    	     cout << "--------------------------------------------------------------------------------------------------------------------------------"<<endl;
    	     cout << "(C) KBM & Envy Inc. Please visit www.envyinc.blogspot.com. "<<endl;
    	
    	for (; att >= 0; att--)
    	{
    		PromScr();
    		
    		if (!stricmp(User, UN) && !strcmp(Pwd, PW))
    		{
    			printf("\nUsername and Password accepted!\n\n");
    			mainkernel();
    			
    		}
    		
    		else if(!stricmp(User, "quit") && !strcmp(Pwd, "exit")){
                 break;
                 }
    		
    		else 
            {printf("\nInvalid Username or Password\n\nYou have %i attempts more.", att);
            }
    	}
}
              
        if(c == 2){
             system("PAUSE");
             }
        if(c == 3){
             cout << "------------------------------------------" << endl;
             cout << "----------------ABOUT---------------------" << endl;
             cout << "------------------------------------------" << endl;
             cout << "The Advanced Cashier 2010 M3 is a program " << endl;
             cout << "to make cashier entries easy and quick.   " << endl;
             cout << "------------------------------------------" << endl;
             cout << "Developed And Compiled by Envy Inc.       " << endl;
             cout << "Special Thanks to KBM and gieselgow for   " << endl;
             cout << "for login and main kernel error debug     " << endl;
             cout << "------------------------------------------" << endl;
             system("PAUSE");
             goto menu;
}
}
// inclomplete class

//Def(Mkaster) Def(PromScr())
//
//PROMSCR
 void PromScr()
    {
    	printf("\nUsername: "); scanf("%s", &User);
    	printf("Password: "); MkAster();
    }
    
//---------------------
//MKASTER    
    void MkAster()
    {
    int i = 0, geth = 0;
    do {
    	
    		geth = getch();
    		if(geth != 13)
    		{
    			if(geth == '\b')
    			{
    				if(i!= 0)
    				{
    					printf("\b \b");
    					Pwd[i] = '\0';
    					i--;
    				}
    			}
    			 else if(geth == '13') printf("\b \b");
    			
    			else 
    			{
    			
    			Pwd[i] = geth;
    			printf("*");
    			i++;
    			}
    		}
    	} while(geth != 13 );
    	
    	Pwd[i] = '\0';
    }

//sum_num.lib
int sum(int b[],int n) 
    { 
      int s=0;
      int i; 
      for(i=0;i<n;i++) 
      { 
                       s+=b[i]; 
                       } 
}

//CASHIER PROGRAM BEGINS..........
//
//________________________________






void runningkernel() 
{ 
    cout<<"press(0) to calculate total price\n"; 
    q:
                    int clientn;
                    string sn;
                    float price,total,payment,balance,quantity; 
                    char date [9]; char time [9];
                    _strdate(date); 
                    _strtime(time); 
                    cout<<"------------------------------------------------------------------"<<endl;
                    cout<<"----------------ADVANCED CASHIER CLIENT NO."<<clientn<<"----------"<<endl;
                    cout<<"------------------------------------------------------------------"<<endl;
                    cout<<"Please Enter Billing Number"<<endl;
                    int bn;
                    cin >> bn;
                    cout<<"Date: "<<date<<endl; 
                    cout<<"Time "<<time<<endl; 
                    cout<<"\t .................................\n"; 
                    cout<<".........................................................\n"; 
                    cout<<"                         "<<"SUPERMARKET BILL ENTRY"<<bn<<"                          "; 
                    cout<<".........................................................\n"; 
                    cout<<"\t .................................\n"; 
                    quantity=0; 
                    total =0; 
                    do
                     { 
                          quantity=quantity+1;
                          cout<<"\t\tPrice for Item No:"<<quantity<<" is :";
                          cin>>price;
                          total = total+price;
                          }while(price!=0);
                          cout<<"\t\tFinal Price\n"<<"\t_________________________________________\n";
                          cout<<"\t\t\t"<<total<<endl;
                          float taxes;
                          cout << "Taxes(if any)" << endl;
                          cin >> taxes;
                          cout<<"\t_________________________________________"<<endl;
                          cout<<"\t\tCash Tendered";
                          cin>>payment;
                          balance=payment-(total+taxes);
                          cout<<"\t\tChange Returned = "<<balance<<endl;
                          cout<<"\t\t\tTHANK YOU. WE HOPE YOU VISIT"<<" "<<sn<<" "<<"AGAIN"<<endl;
                          cout<<"Would you like to serve for the next customer?(1/0)";
                          int g;
                          cin>>g; 
                          if (g == 1) {
                                  cout<<"*************************************************************\n" ;
                                  cout<<"*************************************************************\n";
                                  cout<<""<<endl; goto q;
                                  } 
                                  else 
                                  {cout<<"\t\t**********************\n";
                                  cout<<"\t\t**********CLOSING PROGRAM***********************"<<endl;
                                  cout<<"\t\t**********************"<<endl;
                                  system("PAUSE");
                                  
                                  } 
                                  }

void mainkernel(){
     system("cls");
     cout << "                         ADVANCED CASHIER 2010                 "<<endl;
     cout << "_______________________________________________________________"<<endl;
     cout << "Welcome to the Advanced Cashier. Please enter the name of the  "<<endl;
     cout << "product, then the price and finally the quantity. After you    "<<endl;
     cout << "have finalised the list. Then enter taxes if any and then hit  "<<endl;
     cout << "print to see the list"<<endl;
     cout << "_______________________________________________________________"<<endl;
     system("PAUSE");
     int clientn;
     cout << "Enter Client Number:"<<endl;
     cin >> clientn;
     string sn;
     cout << "Enter Name Of SuperMarket:" << endl;
     cin >> sn;
     runningkernel();
}

>> and also uses EncryPro for encrypting customer ID.

In USA customers do not have IDs. Only the cashier logs into the cash register with a user name and password, then he/she starts processing customers, checking/scanning each item, finally receives the money in the form of cash or check or credit/debit card.

Product Name: Bad idea. Should enter a UPC barcode instead so that the exact item, manufacturer, color, size and/or weight can be easily accounted for in the transaction.

As for taxes -- that is computed by the cash register when the cashier presses the Total button. There is no need for human to enter that amount. In my state there are two different kinds of taxes -- one for food (1.7%) and another for everything else (7.?%). Other states may not tax food. The taxes can get a little complicated which is why its better to let a computer calculate it.

How do I know? I am a cashier at WalMart.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Okay. Thanks For The Reply
Will Bring a Better Milestone.

anuragcoder
Junior Poster in Training
78 posts since May 2010
Reputation Points: 4
Solved Threads: 0
 

Could You Inform Any Better Possibilitites........PM me if so.

anuragcoder
Junior Poster in Training
78 posts since May 2010
Reputation Points: 4
Solved Threads: 0
 

BEST_ASTERIK_SYSTEM_EVER!!! wow, that's really good actually. :)

steventaal
Newbie Poster
23 posts since Mar 2010
Reputation Points: 10
Solved Threads: 1
 

Thank you. I should basically thank my friend KBM for helping me so.

anuragcoder
Junior Poster in Training
78 posts since May 2010
Reputation Points: 4
Solved Threads: 0
 

Why have you mixed cout and printf ? and read here why system("pause") is not a good idea. and read Djikstra's paper on why "goto" is harmful.

Agni
Practically a Master Poster
655 posts since Dec 2007
Reputation Points: 431
Solved Threads: 116
 

Yeah, thanks.... I will improve....
I was using primitive methods.

Sorry.... As I said Milestone 4 is on the way...

anuragcoder
Junior Poster in Training
78 posts since May 2010
Reputation Points: 4
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You