本次加拿大CS作业主要是使用C完成简单的电话簿程序的C语言代写
LIST PROCESSING (LAB#9)
The goals for the experiment:
Design, test, and successfully deploy an application (code) which can process the given .h file and perform the following tasks:
- List all contacts in alphabetical order
- Print phone(s) for a contact
- Find duplicate entries
- Delete contact
- Exit the program
What is not listed below:
- List all contacts in alphabetical order
- Print phone(s) for a contact
- Find duplicate entries
- Delete contact
- Exit the program
• Q: How do we process the given .h file? Using:
Q: How do we process the given .h file? Using:
void convertInputToDataStructure()
• Let’s have a look at .h file
Let’s have a look at .h file
- An array of pointers to strings:
- Both names and numbers are stored as strings
- Name entries do NOT have the same number of phone numbersconst char* contactList[] = { “Johnny Chen”,
“4164769988”,
“6478765679”,"4165463459", "Jane Dunne", "4167889900", "4167886655", "Stephen Doyle", "6477889901",}
Let’s have a look at .h file
• An array of pointers to strings:
const char* contactList[] = { “Johnny Chen”,
“4164769988”,
“6478765679”,- Both names and numbers are stored as strings “4165463459”,
- Name entries do NOT have the same number of phone numbers “Jane Dunne”, “4167889900”,
• Q: How should we design our structure(s) to deal with this?
"4167886655", "Stephen Doyle", "6477889901",}
• Remember we can only have one run to access the data.
• ie. we can not use this file for direct access to the information it contains.