|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Arrays
Hello,
I'm fighting a losing battle with the following program construct. It is part of a college assignment and I would greatly appreciate any help you good people out there may be able to give. The language is C and this is the conundrum: Construct a program that will create an array of names and dates of birth. The user will then be able to type in the name of a person and the array will be searched for that name. If a match is found the date of birth for that person is displayed. I cannot seem to get good form in documenting the correct code layout. My scenario is that I want to use 6 names and 6 dates of birth so that when I type in, for example "John Huston" and hit the return key, his DOB will be displayed. I have included my effort so far using just the one piece of data to give an idea of how I'm going about coding the program. I'm working with the Miracle C Compiler.Hope someone somewhere can help, Thank you, Jude /*Program to create records, store them in an array and search the array for the name and display the result*/ #include <stdio.h> main() { struct persons_rec /*structure template*/ struct date { char surname [7]; char first_name [6]; int date [8]; /*Define structure variable and initialize it with some values*/ struct persons_rec persons = {"Huston"}; struct first_name = {"John"}; { struct date = {12/1/57}; { printf ("Surname in persons is %s", surname); printf ("First name in persons is %s", first_name); printf ("Date in date is %d",& date); } Last edited by Jude Deery : June 22nd, 2002 at 09:15 AM. |
|
#2
|
|||
|
|||
|
What programming language are you working in?
|
|
#3
|
||||
|
||||
|
And what code do you have so far?
Folks aren't going to do your homework for you, but if you put up what you've tried they will be willing to help you work through it. . . |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > Arrays |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|