11-1. Entry and display of contacts (10)

Source: Internet
Author: User

11-1. Entry and display of contacts (10) Time limit MS Memory limit 65536 KB code length limit 8000 B procedure StandardAuthor Joleen (Tsinghua University)

A record in your address book contains the following basic information: Your friend's name, date of birth, gender, fixed phone number, mobile phone number. The subject asks to write the program, enter N records, and display any one record according to the requirement.

Input format:

The input gives a positive integer n (<=10) on line 1th, followed by n lines, each line is given a record according to the format "name Birthday sex landline phone". Where "name" is a non-empty string of no more than 10 characters, does not contain a space, birthdays are given in the format of "YYYY/MM/DD", the gender "M" means "male", "F" means "female", "fixed" and "mobile" are not more than 15 consecutive digits, the preceding may appear "+".

After the Address book entry is completed, the last line gives a positive integer k, and then a K integer indicating the record number to query (from 0 to N-1 sequential number). The numbers are separated by a space.

Output format:

For each record number to be queried, print the record in one row according to the "name Fixed phone sex birthday" format. To query for a record that does not exist, output "not Found".

Input Sample:
3Chris 1984/03/10 F +86181779452 13707010007LaoLao 1967/11/30 f 057187951100 +8618618623333qiaolin 1980/01/01 M 84172333 1 00862 1 7
Sample output:
Laolao 057187951100 +8618618623333 F 1967/11/30not Found
Chinese University mooc-Onge-C language Programming problem sets//create by ZLC on 12/16/2014//11-1.                             Address Book entry and display # include <stdio.h> #include <stdlib.h>struct stu *create_list (int N); struct stu{    Input information structure Char NAME[11];    Char birthday[11];    char sex;    Char phone[17];                    Char mobile[17]; Title requirements: 15 digits, also should include ' + ', so the final array size is set to the Stu *next;};    int main () {int n,k,i;    scanf ("%d", &n);    struct Stu *list,*p;    List=create_list (N);    scanf ("%d", &k);                        int *output;    Enter the record number to output output= (int *) malloc (sizeof (int) *k);    for (i=0;i<k;i++) scanf ("%d", &output[i]);        for (i=0;i<k;i++) {int mask=1,cnt=0;        P=list;                    while (mask) {if (p!=null) {if (Cnt==output[i]) {                    printf ("%s%s%s%c%s\n", p->name,p->phone,p->mobile,p->sex,p->birthday);                mask=0;  } else              {p=p->next;                cnt++;                 }} else {printf ("not found\n");            mask=0;    }}} (output); return 0;}    struct Stu *create_list (int N)//Enter address book through the linked list {struct Stu *head,*front,*new_node;    int i;        for (i=0;i<n;i++) {new_node= (struct stu*) malloc (sizeof (struct stu)); scanf ("%s%s%c%s%s",&new_node->name,&new_node->birthday,&new_node->sex,&new_node->        Phone,&new_node->mobile);        if (i==0) Front=head=new_node;        else front->next=new_node;        new_node->next=null;    Front=new_node; } return (head);}

  

11-1. Entry and display of contacts (10)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.