We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


organiser program

markp370 asked
Medium Priority
Last Modified: 2010-04-15
hi, can u pleae help me with this program im tryin to solve, im an dead stuck, below i have stated the specifcation:

My task is to develop a text-based menu driven electronic organiser application   As well as its normal functions, it must also create a text file of specific records with appropriate fields for transfer of contact details to a mobile phone.

im am required to use a menu based system in the layout below:

1)      The menu.

      The menu structure will contain the following entries

•      Create an entry
•      Amend/Delete an entry
•      Search for an entry
•      Create mobile phone transfer file
•      Quit the application

Below i have listed the file processing specification for the program:
      2)      File Processing
Upon execution the application will ask for the name of the ‘master file’, which will then be supplied by the user.  All of the records in the master file will then be read into       an array before any other processing will occur.  Upon the user asking to ‘Quit’ the application, the user will be asked if the master file should be updated, but only if records have been created/amended and/or deleted.  The structure of a master file       record is as follows:
                  Surname Firstname Address_Line_1 Address_Line_2 Address_Line_3
                  Postcode Home_Number Mobile_Number Email_Address Mobile_Indicator
Each field is separated by a space and the same code given in the lectures will also allow each record to be separated by a new-line ‘\n’ character so it will be easy to create a file of test data in an editor.  One problem you will have is the presence of ‘ ‘ space characters in some of the fields.  You should assume that all fields could hold space characters and when writing out the master file replace all spaces with a field with the ‘_’ underscore character and when reading it in, replace all ‘_’ underscore characters within each field with a ‘space’ character.
When asked to generate a mobile phone transfer file, the program will ask the user for a filename, which will then be used to save the transfer data in.  Only the records with the ‘Mobile_Indicator’ set to ‘true’ will be transferred to the transfer file and only the       following fields will be transferred for each of those records:
                  Person_ID, Number
The ‘Person_ID’ is made upon of the ‘Firstname’ and  ‘Surname’ fields concatenated together with the word ‘Mobile’ or ‘Home’ appended if the ‘Mobile_number’ field or ‘Home_Number’ field is used.  Each part of the ‘Person_ID’ field will be separated by an ‘_’ underline character.  If a master record has data in both numbers then two transfer records should be created.  One for the mobile number and one for the home number. Example, one record with the mobile number will be:
            Joe_Bloggs_Mobile 0123456789

The program also has to be able to search, I have listed the search  specification below:

      3)      Internal Record Processing
            Creating a record will simply mean adding a new record to the next empty element of       the master array.  You should use the ‘strupr’ function from the <string.h> library,       which will convert all characters in a string to uppercase.  If you do this for all user       input for record fields then this will make searching for a record easier.  Use the IDE       help system to find out more about the function. Deleting a record will mean moving       all the records that follow the record to be deleted up an element so that the record to       be deleted is over-written by the next record and so on.  You should store a record in       the array as a ‘struct’ so that you can easily access all of the fields separately.
            Searching should be allowed on the following fields:
                  Surname, Post-code and/or Email Address
      I would much appreciate it you could help me, thanks
Watch Question

Top Expert 2005

What part are you having problems with?  This looks like a schoolwork assignment.
It is against the EE terms of membership for experts to do your homework for you.

We can help you overcome problems you encounter, but "im an dead stuck" is not
really a sufficient description of your problem for us to go on.


its not, sos im just being to detailed, it is a tutorial im doin for my degree,just for practice,the main part im havin a problem with is the part where i am asked to allow the user to input the name of the master file, where the data is be stored and implmenting it,


i just really need help with the structure of the program, im pretty new to programming an im finding the books i have which are the reccomended books arent helping, i am getting better but slowly as u can see,


i have used the example below to try and understand how to relate the menu to each part but have had no success (even though it has nothing to do with the problem):

#include <stdio.h>
#include <stdlib.h>

struct listNode {   /* self-referential structure */
   char data;
   struct listNode *nextPtr;

typedef struct listNode ListNode;
typedef ListNode *ListNodePtr;

void insert( ListNodePtr *, char );
char delete( ListNodePtr *, char );
int isEmpty( ListNodePtr );
void printList( ListNodePtr );
void instructions( void );

int main()
   ListNodePtr startPtr = NULL;
   int choice;
   char item;

   instructions();  /* display the menu */
   printf( "? " );
   scanf( "%d", &choice );

   while ( choice != 3 ) {

      switch ( choice ) {
         case 1:
            printf( "Enter a character: " );
            scanf( "\n%c", &item );
            insert( &startPtr, item );
            printList( startPtr );
         case 2:
            if ( !isEmpty( startPtr ) ) {
               printf( "Enter character to be deleted: " );
               scanf( "\n%c", &item );

               if ( delete( &startPtr, item ) ) {
                  printf( "%c deleted.\n", item );
                  printList( startPtr );
                  printf( "%c not found.\n\n", item );
               printf( "List is empty.\n\n" );

            printf( "Invalid choice.\n\n" );

      printf( "? " );
      scanf( "%d", &choice );

   printf( "End of run.\n" );
   return 0;

/* Print the instructions */
void instructions( void )
   printf( "Enter your choice:\n"
          "   1 to insert an element into the list.\n"
          "   2 to delete an element from the list.\n"
          "   3 to end.\n" );

/* Insert a new value into the list in sorted order */
void insert( ListNodePtr *sPtr, char value )
   ListNodePtr newPtr, previousPtr, currentPtr;

   newPtr = malloc( sizeof( ListNode ) );

   if ( newPtr != NULL ) {     /* is space available */
      newPtr->data = value;
      newPtr->nextPtr = NULL;

      previousPtr = NULL;
      currentPtr = *sPtr;

      while ( currentPtr != NULL && value > currentPtr->data ) {
         previousPtr = currentPtr;          /* walk to ...   */
         currentPtr = currentPtr->nextPtr;  /* ... next node */

      if ( previousPtr == NULL ) {
         newPtr->nextPtr = *sPtr;
         *sPtr = newPtr;
      else {
         previousPtr->nextPtr = newPtr;
         newPtr->nextPtr = currentPtr;
      printf( "%c not inserted. No memory available.\n", value );

/* Delete a list element */
char delete( ListNodePtr *sPtr, char value )
   ListNodePtr previousPtr, currentPtr, tempPtr;

   if ( value == ( *sPtr )->data ) {
      tempPtr = *sPtr;
      *sPtr = ( *sPtr )->nextPtr;  /* de-thread the node */
      free( tempPtr );             /* free the de-threaded node */
      return value;
   else {
      previousPtr = *sPtr;
      currentPtr = ( *sPtr )->nextPtr;

      while ( currentPtr != NULL && currentPtr->data != value ) {
         previousPtr = currentPtr;          /* walk to ...   */
         currentPtr = currentPtr->nextPtr;  /* ... next node */

      if ( currentPtr != NULL ) {
         tempPtr = currentPtr;
         previousPtr->nextPtr = currentPtr->nextPtr;
         free( tempPtr );
         return value;

   return '\0';

/* Return 1 if the list is empty, 0 otherwise */
int isEmpty( ListNodePtr sPtr )
   return sPtr == NULL;

/* Print the list */
void printList( ListNodePtr currentPtr )
   if ( currentPtr == NULL )
      printf( "List is empty.\n\n" );
   else {
      printf( "The list is:\n" );

      while ( currentPtr != NULL ) {
         printf( "%c --> ", currentPtr->data );
         currentPtr = currentPtr->nextPtr;

      printf( "NULL\n\n" );
Unlock this solution and get a sample of our free trial.
(No credit card required)


thanks for that help, its much appreciated, it has helped a lot, thanks

Hi markp370,
          if ur really benefitted from this, then u can also help me out by accepting the answer and awarding the points.
Just a request ;)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.