Arrays

Started by Jude, June 27, 2002, 01:59:56 PM

Previous topic - Next topic
Hello again,

I'm fighting a losing battle with the following program construct.  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);
}


Before I answer this question:

1. Do you just need help on arrays?
2. Do you need help on the structure of the program?
3. Do you need help creating the Names and Dates?
4. Would you like me to write it out for you in working order? I will if you want, but if you are trying to learn it may not be to your benefit.

PLease let me know. because the program took me about 10 minutes.

Wilnix
alt email address: wilnix@hackphreak.org

Jude -

Still waiting... Did you need this or not?

Wilnix
alt email address: wilnix@hackphreak.org

Jude:

I recieved your emails today and I apologize for the delay, but I didn't see an answer on the forum. I built the little program at home and today when I get there, I'll post it.

Wilnix
alt email address: wilnix@hackphreak.org

SMF spam blocked by CleanTalk