Hello I'm back guys! @npcomplete....can't do anything about it dude, its what we use in our school...and Im from the Philippines...when I master this compiler, i'll switch..

So here it is my work so far...Record of 100 Buyers..Please check if I did it right..It worked for me so..yea..

#include<iostream.h>
#include<cstring.h>
#include<conio.h>
struct BuyerInfo
{
 int id;
 string fn;
 string mn;
 string ln;
 string ad;
}
 info[100];
void menu()
{int i=0;
 cout<< "\n================================================================================";
 cout<< "\t\t\n                          WELCOME BUYER!Please fill in the following\n";
 cout<< "\n================================================================================";
 for(i=0; i<1; i++)
 {
  cout<< "\nBuyer's ID:B";
  cin>>info[i].id;
  cout<< "Enter First Name:";
  getline(cin,info[i].fn);
  cout<< "Enter Middle Name:";
  getline(cin,info[i].mn);
  cout<< "Enter Last Name:";
  getline(cin,info[i].ln);
  cout<< "Enter Address:";
  getline(cin,info[i].ad);
}
  clrscr();
  cout<<"\n----------Data---------\n";
     for(i=0; i<1; i++)
     {
        cout<< "\nBuyer's ID:B"<<info[i].id;
        cout<< "\nFirst Name:"<<info[i].fn;
        cout<< "\nMiddle Name:"<<info[i].mn;
        cout<< "\nLast Name:"<<info[i].ln;
        cout<< "\nAdress:"<<info[i].ad;
     }
}
void main()
{
 char ans;
 int buyid;
 struct BuyerInfo info[100];
 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;
}

How is it?...
Question: Now i'll go ahead and make the scan Buyer's items..any suggestions?

Do i have to start a new discussion whenever a question is solved?

yes

How is it?...

The for loops at the menu function is unnecessary, you could simply pass the value for the the stucture index from the main function

Now i'll go ahead and make the scan Buyer's items..any suggestions?

need more details about this, any specifications on what the program should do with the items? store them at a file,etc.?

Do i have to start a new discussion whenever a question is solved?

Not if it's a continuation of the original program. Although if you mark it solved, many people will bypass the discussion.

If you marked the thread solved and later find that you have more questions about the same topic you can change the thread to unsolved then continue the discussion.

Well I found that difficult to read.. You should really really format the code properly before posting it. I know it only takes two clicks to format it A-style but meh. If you did so, more people would take the time to read it.

Also I'm not sure how you got that to compile because there is no cstring.h and no iostream.h

Remove the .h from both of those headers and it'll compile fine.

Also you have quite a lot of compilation errors. If you aren't using std:: infront of standard library functions, then you need to have using namespace std somewhere at the beginning of your code.

Main cannot be void! It must return an int.

Also after std::cin>>info[i].id; you should use std::cin.ignore(); or else it will skip the next line due to the enter/return button being pressed. It needs some error checking for that as well because if the user enters a string, your program will end immediately!

Switch the getlines to cin>> with a cin.ignore.
If an if-else statement has more than one command following it that belongs to its body, it must have brackets..

    else
    {
        std::cout<<"Please Enter BuyerID:";
        std::cin>>buyid;
    }

    //NOT

    else
        std::cout<<"........";
        std::cin>>buyid;       //This is not part of the else statement since it's not in the body.

Here's a semi fixed version (Needs error checking as mentioned above, but other than that, the below works):

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

//using namespace std;      //You can use this instead of putting std:: infront of almost everything.

struct BuyerInfo
{
    int id;
    std::string fn;
    std::string mn;
    std::string ln;
    std::string ad;
} info[100];


void menu()
{
    int i=0;
    std::cout<< "\n================================================================================";
    std::cout<< "\t\t\n                          WELCOME BUYER!Please fill in the following\n";
    std::cout<< "\n================================================================================";

    for(i=0; i<1; i++)
    {
        std::cout<< "\nBuyer's ID:B";
        std::cin>>info[i].id;            //Do some error checking here to make sure the user entered an integer.
        std::cin.ignore();

        std::cout<< "Enter First Name:";
        getline(std::cin, info[i].fn);

        std::cout<< "Enter Middle Name:";
        getline(std::cin,info[i].mn);
        std::cout<< "Enter Last Name:";
        getline(std::cin,info[i].ln);
        std::cout<< "Enter Address:";
        getline(std::cin,info[i].ad);
    }
    system("cls");

    std::cout<<"\n----------Data---------\n";

    for(i=0; i<1; i++)
    {
        std::cout<< "\nBuyer's ID:B"<<info[i].id;
        std::cout<< "\nFirst Name:"<<info[i].fn;
        std::cout<< "\nMiddle Name:"<<info[i].mn;
        std::cout<< "\nLast Name:"<<info[i].ln;
        std::cout<< "\nAdress:"<<info[i].ad;
    }
}

int main()
{
    char ans;
    int buyid;
    struct BuyerInfo info[100];
    std::cout<< "\n================================================================================";
    std::cout<< "\t\t      Welcome to the Black order Grocery system\n";
    std::cout<< "\n================================================================================";
    std::cout<< "\nPlease choose from the following:";
    std::cout<< "\n[A]New user";
    std::cout<< "\n[B]Already a member";
    std::cout<< "\n================================================================================";
    std::cout<< "Answer:";
    std::cin>>ans;
    system("cls");

    if(ans=='A'||ans=='a')
    {
        menu();
    }
    else
    {
        std::cout<<"Please Enter BuyerID:";
        std::cin>>buyid;
    }
    return 0;
}

Well I found that difficult to read.. You should really really format the code properly before posting it. I know it only takes two clicks to format it A-style but meh. If you did so, more people would take the time to read it.

Two clicks of what?

Also I'm not sure how you got that to compile because there is no cstring.h and no iostream.h

Remove the .h from both of those headers and it'll compile fine.

Also you have quite a lot of compilation errors. If you aren't using std:: infront of standard library functions, then you need to have using namespace std somewhere at the beginning of your code.

You don't seem too be familiar with Turbo-C.

Main cannot be void! It must return an int.

This is true...

Also after std::cin>>info[i].id; you should use std::cin.ignore(); or else it will skip the next line due to the enter/return button being pressed. It needs some error checking for that as well because if the user enters a string, your program will end immediately!

Probably true -- didn't check close.

Switch the getlines to cin>> with a cin.ignore.

Wrong. By switching to cin>> when you enter anything with two words, like an address or a last name like "van Dyke" or "van Halen" all you get is "van". Leave the getlines() alone. You want to read the entire line.

If an if-else statement has more than one command following it that belongs to its body, it must have brackets..

Yep.

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.