473,651 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to make a telephone directory????

5 New Member
Can anyone help me in making this program?!...

I need to make a telephone directory using structure definition..

typedef struct AddressTag{
char surname[55];
char givenname[55];
char middleinitial[5];
char telnum[55];
struct PersonTag *next;
} AddType;

I need to have function for inserting, editing and deleting an entry.Entries should be inserted in alphabetical order according to the person's surname.It should also be able to save the entries to a file..
Sep 27 '06 #1
5 8014
D_C
293 Contributor
typedef struct AddressTag{
char surname[55];
char givenname[55];
char middleinitial[5];
char telnum[55];
struct PersonTag *next;
} AddType;

Is this supposed to be a linked list? If your struct is AddressTag, what does PersonTag have to do with it? Where is that defined?

Until we know a PersonTag is, I'm not sure we can help you yet.
Sep 27 '06 #2
yenra
5 New Member
typedef struct AddressTag{
char surname[55];
char givenname[55];
char middleinitial[5];
char telnum[55];
struct PersonTag *next;
} AddType;

Is this supposed to be a linked list? If your struct is AddressTag, what does PersonTag have to do with it? Where is that defined?

Until we know a PersonTag is, I'm not sure we can help you yet.
>
sori, I made a mistake. it should be struct AddressTag *next..
..pls help me..I really had a dificulty in doing this..
Sep 28 '06 #3
yenra
5 New Member
How to make a telephone directory????
--------------------------------------------------------------------------------

Can anyone help me in making this program?!...

I need to make a telephone directory using structure definition..

typedef struct AddressTag{
char surname[55];
char givenname[55];
char middleinitial[5];
char telnum[55];
struct AddressTag *next;
} AddType;

I need to have function for inserting, editing and deleting an entry.Entries should be inserted in alphabetical order according to the person's surname.It should also be able to save the entries to a file...
Sep 28 '06 #4
yenra
5 New Member
..please, I really need help..I have a hard time understanding this topic.. I don't know how to implement this. I need to make a program of an address book using this structure definition in C...

typedef struct AddTag{
char surname[100];
char firstname[100];
char address[100];
char tel_no[50];
struct AddTag *link;
} AddType;
AddType *List //list of entries
..I need to have a function for inserting entries in Alphabetical Order, editing entries, saving to a file and retrieving entries from a file...
..
Sep 28 '06 #5
Banfa
9,065 Recognized Expert Moderator Expert
Please stop reposting the same topic.

You are trying to set up a linked list. In it's simplest form you start with a pointer to the first item. When you need to add a new item you allocate the memory (using malloc or new) fill in your structure and then make you new structure next pointer equal to the current first pointer and the then the first pointer point to the new structure.

Expand|Select|Wrap|Line Numbers
  1. AddType *pFirst = NULL;
  2.  
  3. void AddItem()
  4. {
  5.     AddType *pNewAdd = new AddType;
  6.  
  7.     pNewAdd->link = pFirst;
  8.     pFirst = pNewAdd;
  9. }
  10.  
You can list all the items by just taking apointer starting at the first item and itterating down the list until you get to NULL

Expand|Select|Wrap|Line Numbers
  1. void PrintList()
  2. {
  3.     AddType *pCurrent;
  4.  
  5.     for(pCurrent=pFirst; pCurrent != NULL; pCurrent=pCurrent->link)
  6.     {
  7.         // output data in pCurrent
  8.     }
  9. }
  10.  
Deleting at the begining of the list involves moving the first pointer onto the next item in the list and then delting the memory that it pointed to

Expand|Select|Wrap|Line Numbers
  1. void DeleteFirst()
  2. {
  3.     AddType *pDelete = pFirst;
  4.  
  5.     if (pDelete != NULL)
  6.     {
  7.         pFirst = pFirst->link;
  8.         delete pDelete;
  9.     }
  10. }
  11.  
Sep 28 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

383
12066
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a poor man's DBMS, a broken email server and various other /application/ servers to try and crack the Internet and IS markets. In the case where they didn't spend their own money to get companies to
4
7527
by: Iftikhar Hussain | last post by:
Hello Everyone Nice to be back here, well all u guys have helped in past & now I would like a favor again. first what i want to develop is as follows: An application for rescue station, where there is a Telephone & a Computer System . the telephone is also connected with the computer system, so when the telphone rings, the Computer can act as a CLI & could identify, which number the call is coming from. it gets that number, matches it...
4
3687
by: sandeep | last post by:
When we use STL which memory space it will use whither it is stack or heap or data segment How to make STL to create in heap? How to make whole container to create in heap? I think container uses stack is it correct ? I am using double linked list so in place of it I want to use STL for #include<stdio.h> #include<iostream>
2
1688
by: Compustudent | last post by:
Hi, I am trying to find out if there is a pre written script to submit a query to a telephone directory site (like whitepages.com) and will the bring back just the results and strip away all the adds/images. Thank You
1
1364
by: Gulcim | last post by:
Hi Please help me! How can I transfer users' telephone numbers from sql database to active directory users properties. Do Anybody know script about it? I have nearly 5000 users in sql database.
0
880
by: Gulcim | last post by:
Hi Please help me! How can I transfer users' telephone numbers from sql database to active directory users properties. Do Anybody know script about it? I have nearly 5000 users in sql database. Thank you..
1
1828
by: Robert Johnson | last post by:
Hi all. I need to format my text box's and combo box's with Telephone (###) ###-#### and Postal Code #####-#### or other custom formating, how do I do this? I tried to go into Properties, Databindings, Advanced and to use the Custom but it didn't work to well. To clarify: it placed (###) ###-#### in my Telephone field but didn't guide my user or format the number after entering data, so it was pretty useless. Obviously I didn't do it...
1
2241
by: silent15 | last post by:
I am having a bit of trouble writing a function for a telephone directory. I need to create a program that upon prompt of first and last name it needs to output the corresponding number from a dat file or indicates that the name isnt in the file. then after each lookup i need to ask whether to look up another number or exit. this is the code I have so far, I am not very good with functions so... #include <iostream> #include <string>...
0
2856
by: tlontz | last post by:
I am trying to retrieve the telephone_number from active directory using the following script: Dim search As New DirectorySearcher("") search.Filter = "(&(objectCategory=Person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(samaccountname=" + UserName.ToString.Trim + "))" 'search.Filter = "(&(!(userAccountControl:1.2.840.113556.1.4.803:=2))( objectCategory=person)(samaccountname=" +...
0
8349
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8576
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.