address book

im supposed to create an address book and so far have gone as far as getting the input..my problem now is the highlighted section..i have to return bak the info put in initially by the user (first, last name and address), based upon a question to the user to input either the last name or the first and last name of the persons he wants to pull up. would appreciate some help
thnx

my loop is off and i cant see why, and im getting weird signs. the thing is im supposed to keep asking the user if he wants to find the initial input info, based on an input off person's last name or first name and last name until he decides to exit.
plz help...
thnx

why dont these 'for(int i = 0; ;i++)' loops have any comparison condition? when will it stop? I think before you complete this assignment you need to understand loops and arrays once more.. dont even try to solve it before you re-read those topics, ur basics are not correct and your just trying to somehow get the output without understanding what your doing here .. and you might just make yourself learn something wrong ... hit the books and then attempt it again... all the best

You are using C style strings for the names, which is fine, but you can't compare C style strings using the == operator. You can compare stl string objects using the == operator. To compare C style strings for equality you need to use strcmp() and evaluate the return value. If the two strings are the same the return value should be zero.
----------------------------------------------
I'd tell the user how to exit the loop explicitly.

There is another problem with your code if(people[i].lastname == lastname) You cannot compare two char arrays with the == operator. You either need to define them as "string" or you need to use strcmp() to compare them.

>>if(people.lastname == lastname)
You can't compare two character arrays with the == operator like you do two std::strings. To compare character arrays call strcmp() functions. if( strcmp(people[i].lastname == lastname) == 0)

alrite..so hopefully this should be my last problem...based on my recent understanding i had to create a menu to ask the user what he wanted to do at any point in time (add person or get person) and i have to do this untill either the address book is filled with 10 people or the user enters 2..so the problem now is trying to to add the people to my 10 slots

You probably want to write something like this. I am assuming here that you only want to enter the information for 1 person at a time, and you want to exit once you have called getperson. If you want to call getperson mutliple times, you will need another option to specify your exit. If you want to add mutiple users at the same time then you'll need to pass in the current index you are at and the number of users you want to add and accordingly increment userinputcounter.

yeah i do want to add the info 1 at a time..but lets say the user adds a person and gets a person..he should still be able to add or get once hes done any of the 2...ill deal with the exit option later

Well you have to figure out where to stop, else you will stay in an infinite loop. You could add an option 3 for exit, and when that is entered, set done to true. Else keep looping. It will keep adding upto 10 names and then keep calling getname until you exit.

else if(addressbookfull > 10 || userinput == 2)
{
if (addressbookfull > 10 && userinput == 1){
cout<<"The address book now has more than 10 people so you can only get a person"<<endl;
}
getperson(people, userinputcounter);
}

yeah that block is pretty much what i had but in 2 different else ifs..even still yours doesnt work

A block such as this will get your job done.

else if(addressbookfull > 10 || userinput == 2)
{
if (addressbookfull > 10 && userinput == 1){
cout<<"The address book now has more than 10 people so you can only get a person"<<endl;
}
getperson(people, userinputcounter);
}

Send the number of actual person objects stored in people at any given time to getperson(), not the maximum number of person objects that can be stored in people. Then check the number of person objects stored in people to determine if people is empty. Don't try to evaluate the value of some indexes firstname, etc to determine if people is empty. If this:

people[personumber].firstname != 0

is true that means there is probably a person object in people, but maybe not.

When you declare people to be an array with enough memory to hold 10 person objects, there are no person objects in there just because you declare the memory for the objects.

Likewise, when you declare a person object, the firstname variable isn't given the value of NULL by default. firstname doesn't have any value until it is assigned one, whether it be NULL or Jane or Bill or whatever. Same for lastname and address.

im not too sure u follow what im supposed to do with my getperson func or maybe i dint follow wht u said..i have to get a person if the user inputs 3 and i start at people element 0..now if people element 0 is empty i have to output that if statement but its not working..knowing that my address book can only have 10 people i think im just gona pass 10..but i know there is probably some error with my condition in the if statement..so how can i rectify that setting a condition if that people index is 0
thnx

nope..see the user runs the program and at any point in the prog he inputs 3 which then calls on the getperson function..when it is initiated it starts from element 0..next time it gets called element 1 all the way upto 9 and then gets back to zero this is the way its supposed to work..now i jst wana setup a condition in which if that element has still not been filled say it is empty in that element..so how do i design my condition inside the if ??

unfortunately..i dont know what that is..isnt there an easier way to do this?? i mean the only problem is just coming up with the right condition, which i think is setup right but cant think of how it sees the array when there is nothing in there

what is inside that array element if it does not contain anything?? if it is a zero, null or sumthin how can i use that as my condition??

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...