Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Use C program to write a simple address book: (http://www.go4expert.com/forums/c-program-write-simple-address-book-t29492/)

johnjrgs 16Feb2013 01:07

Use C program to write a simple address book:
Create a simple address book program that stores the first name, last name, student number, degree program, mobile number and email address of a student. The program will have five possible actions:add a new entry, edit an existing entry, delete an existing entry, list all entries, and close the program.The program should keep asking for the next action until the user closes the program.
Aside from your own functions, you are only allowed to use the functions in the following
There should be a macro in your code defining the number of entries in your address book. The
maximum allowable number of entries is 30.
There should be no recursive functions.
The inputs should have the following error checking capabilities:
first name, last name, degree program: can only contain letters and spaces, max of 20, at
least one character
student number: can only contain digits and a dash, format is xxxx-yyyyy
mobile number: can only contain digits, format is 09xxyyyyyyy
email: can only contain letters, digits, underscores, dots, and @, max of 30
Implement this using only the concepts discussed from lectures 1 to 8a.

So far the code that I have written is here:


#include <stdio.h>
#include <string.h>
#define max_num 30

void add_contact();
void edit_contact();
void del_contact();
void list_contact();

int main()

char mode, size;
char addressbook[6][30][30];

    printf("Select the mode you want\n");
    printf("1 -> Add contact\n");
    printf("2 -> Edit contact\n");
    printf("3 -> Delete contact\n");
    printf("4 -> List contact\n");
    printf("5 -> Exit the program\n");
    scanf("%c", &mode);
    switch(mode){ //switch (determine which action to take
    case 1:
    case 2:
    case 3:
    case 4:
    } //end switch
    return 0; 

My problem is how to make the functions' body. Please help me..
I also need to keep track of the input since the max number of entries is 30. I don't know how to do that though.

All times are GMT +5.5. The time now is 19:06.