I am new to C++ and I am trying to write a program that creates an address book
ID: 3685621 • Letter: I
Question
I am new to C++ and I am trying to write a program that creates an address book via the use of arrays and structures. Eventually, I will need to have functions that allow me to add, delete, and look up contacts (not worried about that part yet). We are supposed to read the Contact information in from an input file thats arranged like this:
Adam,Roberts,7571234567
123 1st Street,Chesapeake,Virginia,23322
Bill,Harper,7572345678
456 2nd Street,Chesapeake,Virginia,23322
John,Johnson,7579876543
789 3rd Street,Chesapeake,Virginia,23322
I am having a hard time reading the contact info into an array from the input file. Do you see anything wrong with what I have for the ReadValue function? When I run the program and try outputting the contents of the array there is nothing in the elements and the value of numContacts is 0 (the input file has data in it and is properly formatted). The following is a list of my structures and the function to read in values. We just started covering arrays in class and I am a bit lost and not sure if this question is properly formatted so you could answer it but any help would be greatly appreciated.
Explanation / Answer
1. Please paste entire program along with main. (Dont take a pic, paste the code)
2. Your ReadValues() is not returning and its not taking any parameter. How you are using it to get contact1 array in main function?
Your getline method is correct
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.