Contacts list

0 Krasimir Yordanov · November 24, 2015
Hello everyone. I am very excited to be a part of this society. Im a first year student and im studying programming.
This is my very first topic here, i would like to ask you for some help about a short program.
I must make something like a contacts list. The numbers and the names must be able to get  in by files.
There must be a search tool and the capital letter and the small letters should be ignored 
(JeRry == jerry). Also it must be able to give you out a number and also it must be able to write in a number 
By typing. Thank you very much for your time! 

Post a Reply

Replies

Oldest  Newest  Rating
+1 Dan P · November 25, 2015
Hi Krasimir,

Design how you are going to hold the data first.

Once you have the data in the program, you can write the other functions so that you can do what you want with the data.

For example,

struct person {
char name[100];
char number[100];
};


In this example I have created a structure called person that will take a name and number.

I didn't choose an int for the number because someone's phone number is actually just a string, you are not going to add another
phone number to it.

So, how do we create a contact list?

int main() {
struct person contactList[100];
}


So now we have the person structure 100 times in an array.

What happens if I have 2 people with the same name?

struct person {
char name[100];
char number[100];
}; // This structure isn't suitable any more.

struct person {
int id;
char name[100];
char number[100];
}; // Now I have an id. I just have to remember in my add function that I need to check that it's unique!


I have added an int field that will be our unique identifier.
This is a simple way of completing this task, and you should ask yourself what could be the pro's and con's of using the things that I have used.
*hint* We are limited to 100 contacts with this system.
Hope this helps. :)
0 Krasimir Yordanov · December 2, 2015
geez, thanks dude! u the real mvp :D
  • 1

C

107,033 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator