//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?

1) Stop putting your question into your code. Your question is not code.

2) #include<conio.h> -- don't use this. It's not standard and is not necessary.

3)

struct BuyerInfo
{
 int id;
 string fn;
 string mn;
 string ln;
 string ad;
};BuyerInfo info;

Why is the first semicolon in this line: };BuyerInfo info;?? And indent the fields more.

4) void menu() -- main is and always has been an int.

5) void main() -- twice? That's bad.

6) You don't define your array on the structure name. The array goes on the variable name.

uhm... WaltP, point 4 on your list is not "main" but "menu"... and I believe it can be void...

and the semicolon in point 3 is an end while the rest should just be spaced into a new line as an variable of the struct (I hope I said it right)

Ron Walt is correct on his points though he seems very irritated and quick to show out problems, thats the general coder way, try making your code easier to read and please dont be afraid of open lines and indentation... eg:

struct BuyerInfo
{
    int id;
    string fn;
    string mn;
    string ln;
    string ad;
};

BuyerInfo info;

and now, see BuyerInfo as a "datatype"... info as a variable of that type...

how would you create an array of 100 integers? apply the same

oopss.thanks alot...so sorry about that mr.waltp....btw, im using turbo c++ 4.5 compiler..and yea its outdated...I just started reading structs...this is what i get for missing the lesson in my class..thanks for the information

commented: teachable and humble, generally pleasant +3

cool man... give it a try, see how it goes, and if you manage just remember to mark the thread as solved

@ Ron Kevin

As you already said that turbo is outdated, why don't you change to something new and "trendy" ;) Like Code::blocks, its a very nice IDE and has MinGW compiler.

uhm... WaltP, point 4 on your list is not "main" but "menu"... and I believe it can be void...

Yep, read it too fast. Sorry.

and the semicolon in point 3 is an end while the rest should just be spaced into a new line as an variable of the struct (I hope I said it right)

I suppose so... But if you weren't even sure ;)

Ron Walt is correct on his points though he seems very irritated

Don't make snap judgements about people's states of mind. Keep your opinions to yourself in regard to mental states. You don't want to put a bad ligth on a member for no reason, and it's quite close to a rules violation.

and quick to show out problems,

Should I have waited an hour? ;o)

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?

I hate memories but instead I want reality, A reality where I exist, and you are here next 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.