Grocery Point of sale system...
-advises only, thanks!
So here it is: 
1. The system should have an ability to store up to 100 records.

2. Provide the following POS Application:
    a. Scan Buyer's Items-i'm not really sure about this one..is this where i'l input the barcodes of the //items to be bought?
    b. Additional items-To add items, search first for the buyer ID, and then show all the Barcode, //Product name and Quantity of all products bought. Ask also how many quantities will be added.
    c. Cancel items-To cancel items, search first for the buyer ID, and then show all the Barcode, //Product name and Quantity of all products bought. Ask also how many quantities will be cancelled.
    d. Search record-searching a buyer via Buyer ID.
    e. Delete record
    f. List of products available-List of barcode, name, category and individual prices of products
    g. Show products based on Product category-Can't understand this one.
I'm starting on it now....this is what i have so far:(i already have a basic problem)

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


        int id,adn;
        string fn, ln,mn,ad,ch;
        void main()
        {

            // current date/time based on current system
            time_t now = time(0);

            // convert now to string form
            char* dt = ctime(&now);

            cout << "Date and time: " << dt << endl;
            cout<< "\t\tWelcome to the Black order Grocery system\n";
            cout<< "\nPlease enter the following data:";
            cout<< "\nBuyer's ID:B";
            cin>>id;
            cout<< "\nFirst Name:";
            cin>>fn;
            cout<< "Middle Name:";
            cin>>mn;
            cout<< "Last name:";
            cin>>ln;
            cout<< "Address:";
            cin>>adn;cin>>ad;
            clrscr();
            cout<< "[1]Scan Buyer's Items";
            cout<< "\n[2]Additional Items";
            cout<< "\n[3]Cancel Items";
            cout<< "\n[4]Searching for Buyer's Record";
            cout<< "\n[5]Deleting Buyer's Record";
            cout<< "\n[6]Show all Products available in the Grocery Store";
            cout<< "\n[7]Show Products based on Product Category";
            cout<< "\n[8]Exit";
            cout<< "\nOption:";
            cin>>ch;
            clrscr();
        }






-when i add a space or if i put my second name it immediately goes to last name
-It's not much but as i mentioned i just started doing it right now...so there will be updates //later...Please I need your expert advises, i want to perfect this project!

Recommended Answers

All 13 Replies

I compiled your program with vc ++ 2012 and, after changing a couple things to make it compatible with new compilers, it worked as expected for me. I don't have Turbo C so I can't tell you if its your compiler or not that is causing the problem. Or maybe you just misunderstand how the program is supposed to work correctly.

-when i add a space or if i put my second name it immediately goes to last name

Provide sample input, expected output, actual output. You may need to use a different input method, say getline() instead of >>.

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



double id,adn,ch,order[100];
string fn, ln,mn,ad;

void scan()
{
 cout<< "\t\t\t   List of Product available";
 cout<< "\nBarcode\t\t  Name\t\t  Category\t\t  Individual Prices";


}
void main()
{

    // current date/time based on current system
    time_t now = time(0);

    // convert now to string form
    char* dt = ctime(&now);

    cout << "Date and time: " << dt << endl;
    cout<< "\t\t     Welcome to the Black order Grocery system\n";
    cout<< "\nPlease enter the following data:";
    cout<< "\n================================================================================";
    cout<< "\t\t\t         BUYER'S INFORMATION";
    cout<< "\n================================================================================";
    cout<< "\nBuyer's ID:B";
    cin>>id;
    cout<< "First Name:";
    getline (cin,fn);
    cout<< "Middle Name:";
    getline (cin,mn);
    cout<< "Last name:";
    getline (cin,ln);
    cout<< "Address:#";
    getline (cin,ad);
    clrscr();
    cout<< "\n================================================================================";
    cout<< "\t\t\t         POINT OF SALE SYSTEM";
    cout<< "\n================================================================================";
    cout<< "\nPlease choose from the following:";
    cout<< "\n[1]Scan Buyer's Items";
    cout<< "\n[2]Additional Items";
    cout<< "\n[3]Cancel Items";
    cout<< "\n[4]Searching for Buyer's Record";
    cout<< "\n[5]Deleting Buyer's Record";
    cout<< "\n================================================================================";
    cout<< "\n================================================================================";
    cout<< "\nOption:";
    cin>>ch;
        switch('ch')

            case 1:
                scan();

}
 //so what is wrong with my case??it wont go in my UDF it just shows a blank page

nevermind...i fixed it...

Okay so I'm not finished yet doing my code...im on the 1st part..The scan buyer's items...

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



long double id,ch,ch2,order[100],q[100];
string fn,ln,mn,ad;

void menu()
{
    cout<< "\n================================================================================";
    cout<< "\t\t\t         POINT OF SALE SYSTEM";
    cout<< "\n================================================================================";
    cout<< "\nPlease choose from the following:";
    cout<< "\n[1]Scan Buyer's Items";
    cout<< "\n[2]Additional Items";
    cout<< "\n[3]Cancel Items";
    cout<< "\n[4]Searching for Buyer's Record";
    cout<< "\n[5]Deleting Buyer's Record";
    cout<< "\n================================================================================";
    cout<< "\nOption:";
    cin>>ch;
    clrscr();
}
void scan()
{
 cout<< "\n================================================================================";
 cout<< "\t\t\t   List of Product available";
 cout<< "\n================================================================================";
 cout<< "\nBarcode\t\t  Name\t\t  Category\t\t  Individual Prices";
 cout<< "\n0001   \t\t  Bread \t    Bakery            \t\t35.00";
 cout<< "\n0002   \t\t  Soap  \t    Hygiene           \t\t20.00";
 cout<< "\n0003   \t\t  Milk  \t    Dairy             \t\t40.00";
 cout<< "\n0004   \t\t  Apples\t    Fruit             \t\t30.00";
 cout<< "\n0005   \t\t  Gelatin\t    Snacks            \t\t15.00";
 cout<< "\n0006   \t\t  Candy \t    Snacks            \t\t25.00";
 cout<< "\n0007   \t\t  Catsup\t    Condiments        \t\t40.00";
 cout<< "\n================================================================================";
 cout<< "\n================================================================================";
 cout<< "\nBuyer ID#: B"<<id;
 cout<< "\nName: "<<ln<<", "<<fn<<" "<<mn;
 cout<< "\nAddress:"<<ad;
 cout<< "\nDate:";
 time_t now = time(0);
 char* dt = ctime(&now);
 cout<<dt;
 cout<< "\n\t\t   Barcode and Quantity of Products Bought";
 cout<< "\n\t\tBarcode\t\t\t\t     Quantity";
 gotoxy(18,25);
 cin>>order[0];
 gotoxy(56,23);
 cin>>q[0];
 cout<< "\nPrint Receipt?[y/n]";




}
void main()
{

    // current date/time based on current system
    time_t now = time(0);

    // convert now to string form
    char* dt = ctime(&now);

    cout << "Date and time: " << dt << endl;
    cout<< "\t\t     Welcome to the Black order Grocery system\n";
    cout<< "\nPlease enter the following data:";
    cout<< "\n================================================================================";
    cout<< "\t\t\t         BUYER'S INFORMATION";
    cout<< "\n================================================================================";
    cout<< "\nBuyer's ID:B";
    cin>>id;
    cout<< "First Name:";
    getline (cin,fn);
    cout<< "Middle Name:";
    getline (cin,mn);
    cout<< "Last name:";
    getline (cin,ln);
    cout<< "Address:#";
    getline (cin,ad);
    clrscr();
    do
    {
        menu();
            if(ch==1)
            {
             scan();
            }

    }
    while(ch2=='Y'||ch2=='y');
    }

the problem here is how am i supposed to let te user input as much items as he wants but the orders should not exceed 100...i think ill use for loop but im kinda confused about how to do it...

Use a loop condition that calls for an authentication of input function and returns negative if its not authentic input.

int authenticationReturn = 1;

while( authenticationReturn == 1)
{

    // take user input

    authenticationReturn = authenticate ( user input )

}

authenticate () will return 0 if it exceeds 100. You can also use a do while loop for this purpose, if you want that atleast once the user will give input.

I'm still not sure what you meant by that...maybe a sample output would make you explain to me a much more easy or basic explanation.

Sample output:

Barcode      Quantity
 0001           2
 0002           3

-the user inputs the barcodes to be bought and its quantity
(and at the same time its being restored in an array maybe or a struct..), considering the order of the user does not exceed 100..

Your loop terminates when either of two conditions occurs: the user indicates there are no more items to scan in or the number of items has reached the maximum (100).

Within the loop, the user enters the barcode and quantity, the number of items is updated, and if the limit hasn't been reached prompt the user to indicate whether there are more items.

See if you can code a loop to do that. Post your code if you have trouble getting it to work.

do
{
    cin>>order[0];
    cin>>quantity[0];
    order++;
    quantity++;

}

while(order==100);

hmmm...i did this on a whim...

how about i use a struct in this barcode and quantity....i think its the best solution?i just have to figure out how to do it properly

Try working out the steps you'd need, in plain english, so that you have an algorithm to work with. Once you have that algorithm, you can work out how to code it up, including how to store the input.

You know you need a loop of some sort. You know that for each iteration of the loop you will get a value for barcode and a value for quantity, and you will update a count. Prior to the first iteration of the loop the count will be zero. Within the loop you'll get confirmation whether there's another item. The loop will teminate when the count reaches the limit, or there is not another item. Can you break that down into simple numbered steps, in plain english, that can then be turned into code?

thanks..i kinda understand my project..i'll post my code maybe this saturday...i need critics so that i can improve the code..thanks a lot!

//Ok so here's my plan so far please check if i'm on the right track guys! thanks!
#include<iostream.h>
#include<cstring.h>
#include<conio.h>

struct BuyerInfo
{
 int id;
 string fn;
 string mn;
 string ln;
 string ad;
};BuyerInfo info;
void menu()
{
 cout<< "\n================================================================================";
 cout<< "\t\t\n                          WELCOME BUYER!Please fill in the following\n";
 cout<< "\n================================================================================";
 cout<< "\nBuyer's ID:B";
 cin>>info.id;
 cout<< "Enter First Name:";
 cin>>info.fn;
 cout<< "Enter Middle Name:";
 cin>>info.mn;
 cout<< "Enter Last Name:";
 cin>>info.ln;
 cout<< "Enter Adress:";
 cin>>info.ad;
}
void main()
{
 char ans;
 int buyid;
 cout<< "\n================================================================================";
 cout<< "\t\t      Welcome to the Black order Grocery system\n";
 cout<< "\n================================================================================";
 cout<< "\nPlease choose from the following:";
 cout<< "\n[A]New user";
 cout<< "\n[B]Already a member";
 cout<< "\n================================================================================";
 cout<< "Answer:";cin>>ans;
 clrscr();
    if(ans=='A'||ans=='a')
        {
          menu();
        }
    else
      cout<<"Please Enter BuyerID:";
      cin>>buyid;

}
//as you can see my program would ask the user first if he or she is already registered
//if he/she is then the program would ask the user to input his BuyerId and boom! it goes to his records
//although i haven't done it i just want to tell my plan...else if he is not registered, void menu() would 
//take place..the question now is..did i do it correctly?Did the member variables on my struct got all 
//the inputs?..my last question, my project says, the program should be able to store 100 records..
//i tried putting an array size on my struct..like this but it has an error: struct BuyerInfo[100]. 
//Can anyone explain this to me?
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.