473,385 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Visual Programming.

Question Details:

Maintain a family tree and output family data in correct order.

Details

To solve this problem you have to:

Declare structure named Family that has following eight members:

Structure Family

member of type Description

dob Structure Date Date of Birth

name character array of size 20 Name

father character array of size 20 Father’s name

mother character array of size 20 Mother’s name

next Structure Family pointer Pointer to next structure

previous Structure Family pointer Pointer to previous structure

p_to_father Structure Family pointer Pointer to father structure

p_to_mother Structure Family pointer Pointer to mother structure





Structure Date

member of type

day integer

month integer

year integer

Define a function (say get_personInfo) to take input of family members.

Arguments no arguments

Return type a pointer to a Family Structure.

Within the function

Define a pointer to Family type Structure (say temp) and allocate it memory by calling malloc()

Take following input from user:

Name of Person, Date of Birth, Father’s name, Mother’s name

and store this information into temp and return temp.

Define a function (say related) to fill in pointers to mother or father relationship

Arguments two pointers to Family Structure (say first person and second person)

Return type true or false



Within the function

call set_relationship twice to test all possibilities of relationship. That is:

return set_relationship(first person, second person) || set_relationship(second person, first person)

set_relationship()

Arguments two pointers to Family Structure (say first person and second person)

Return type true or false

Within the function

if first person’s father is equal to second person’s name

first person’s p_to_father = second person

return true

if first person’s mother is equal to second person’s name

first person’s p_to_mother = second person

return true

otherwise

return false

The main() function

Declarations:

name of type Description


first Structure Family pointer Pointer to first person

current Structure Family pointer Pointer to current person

last Structure Family pointer Pointer to last person

input char input character Y or N

/* take input from user */

infinite loop

printf “Do you want to enter details of a person (Y or N)? ”

scanf input

if input is n

break the loop

current = get_personInfo()

if first == NULL

first = current

last = current

else

last->next = current

current->previous = last

last = current

/* check and set the person’s relationships */

Point current to the first

loop until current->next is not NULL

declare a parent count of type int local to this block

point last to current->next

loop until last is not NULL

if related(current, last)

if(++parent == 2)

break the inner loop

last = last->next

current = current->next

/* Output family data in correct order */

Iterate through the list and print person’s name, birth day, birth month, birth year

and also parent’s information i.e.; name, birth day, birth month, birth year

/* Free the memory allocated through malloc() */

Iterate through the list and call

free(current)

Sample Output

Do you want to enter details of a person (Y or N)? y

Enter person name: ABC

Enter ABC’s date of birth (day month year): 2 2 70

Enter ABC’s father name: DEF

Enter ABC’s mother name: GHI

Do you want to enter details of a person (Y or N)? y

Enter person name: JKL

Enter JKL’s date of birth (day month year): 4 4 74

Enter JKL’s father name: MNO

Enter JKL’s mother name: PQR

Do you want to enter details of a person (Y or N)? y

Enter person name: STU

Enter STU’s date of birth (day month year): 6 6 96

Enter STU’s father name: ABC

Enter STU’s mother name: JKL

Do you want to enter details of a person (Y or N)? n





ABC was born in 2/2/70, and has DEF and GHI as parents.

JKL was born in 4/4/74, and has MNO and PQR as parents.

STU was born in 6/6/96, and has ABC and JKL as parents.

ABC’s Birth date is 2/2/70 and JKL’s birth date is 4/4/74.
Mar 26 '07 #1
3 1121
Dököll
2,364 Expert 2GB
Hello Lady dyna!

Sounds like a wonderful project, I wish you luck in it. Would you mind adding your code, if you have it? Just in case anyone here would like to take a shot at it...

Welcome!

Dököll
Mar 26 '07 #2
SammyB
807 Expert 512MB
I agree with Dököll, it sounds like a wonderful project. But, what is your question? On the remote chance that you wanted me to write a solution, you should know that I charge $100 per hour. If you have a question, then be sure to make it specific and short. Also, please tell us what VB you are using: VB.NET 2003, VB.NET 2005, VB6, or VBA. Thanks! --Sam
Mar 26 '07 #3
Killer42
8,435 Expert 8TB
As a Moderator (there’s more than one), I feel I should clarify the position of TheScripts. We are all volunteers who help out because we like to, for whatever reasons. We don't charge for answers. (In fact we can't, the site doesn't even have any sort of payment mechanism, as far as I'm aware.)

What I think SammyB was hinting at is the fact that we expect people to make a serious attempt at writing their own program, and post specific questions here if they get stuck. We're not a programming school, or a software development firm. Of course, once you do have a specific programming question, we’ll be glad to help.

One more thing. Considering the apparent nature of your question, I feel I should draw your attention to the posting guidelines – specifically the section on Posting Homework or Coursework Questions and Answers.
Mar 26 '07 #4

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

Similar topics

2
by: AK | last post by:
I don't want any part of the previous discussion on Visual Basic versus Visual Basic.Net. My query is about using Visual Basic for Applications; and whether it is better to use Visual Basic 6 or...
6
by: Martin Bless | last post by:
The good news: Along with Python-2.4 comes really good news to Windows users. Yes, you now CAN build extension modules yourself using the SAME C++ compiler and linker Python is built with...
16
by: TB | last post by:
Hi all: If you think that the following comments are absolute amateurish, then please bear with me, or simply skip this thread. A couple of months back I made the decision to initiate a...
8
by: Will Chamberlain | last post by:
I came across a rather interesting article this morning and thought I'd share. We all know that Visual Studio is a great IDE, but I think we can all agree that it is adds a dramatic change to how...
3
by: jaYPee | last post by:
i am searching a lot of resources in the net that discusses about database programming. i'm still searching on it and would like to received any links that discusses about database programming in...
0
by: Nospam | last post by:
Powware Visual Programming is the world's first environment for creating software using the Powware Visual Programming Language on the Tablet PC. Be one of the first in the world to experience...
2
by: Nospam | last post by:
Powware Visual Programming is the world's first environment for creating software using the Powware Visual Programming Language on the Tablet PC. Be one of the first in the world to experience...
54
by: m.roello | last post by:
In the book: "Working with Microsoft Visual Studio 2005" Craig Skibo wrote: "The power of Visual Studio 2005 lies in its ability to empower users to build, test, and debug powerful applications...
97
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.