I am trying to make a program that
1) Ask how many positions the user would like
2) Prompt a list of address book questions for them to fill in the data
3) ask which position to view
4) show all of the information in that position
Basically I am thinking of making an array. They input how many elements to make in it. it then asks a list of questions I made in a structure and then asks which element to view and when they pick an element it shows the entire thing. This is what I have so far:
As you can see for now I am just working with the first two entries in the structure to see if I can get it to work.Code:#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int entries; cout<<"How many entries would you like? "; cin>>entries; struct person { string phoneNumber; string wholeName; /* string address; string DOB; string eMail; string favoriteShow; string city; string state; string zip; string myspace; string favoriteFood; string gamerTag; string hairColor; string organDonar; string salary; string employer; string placeOfBirth; string mothersMaiden; string teacher; */ }; int i; for (i=0; i<entries; i++) { int myArray[entries]; person info; cout<<"Enter Phone Number: "; cin>>info.phoneNumber; cout<<endl; cout<<"Enter Whole Name: "; cin>>info.wholeName; cout<<endl; } system("PAUSE"); return EXIT_SUCCESS; }
I think I am on the right track but
struct myArray[entries];
gives me an error and only works when it is
int myArray[entries];
but shouldn't it be struct since I am putting a structure into the array and not an integer?
Please help!
I would love for someone to just do the entire thing for me so I can learn from it and don't have to beat my head against the wall anymore, but any help is appreciated. =]