* Structure-04. Enter and display the address book

Source: Internet
Author: User
1/* 2 * Main. C 3 * F4-structure-04. 4 * created on: August 26, 2014 5 * Author: in the boomkeeper 6 ******** section, ********** 7 */8 9 # include <stdio. h> 10/** 11 * Address Book structure 12 */13 struct contact {14 char name [11]; // The "name" is 15 char birthday [11] with no more than 10 characters; // The birthday is given in the format of "yyyy/mm/DD; // use M to indicate male and F to indicate female. 17 char Tel [16]. // "fixed-line" and "Mobile Phone" are continuous numbers of no more than 15 digits, and "+" 18 char Mobile [16]; 19} may appear before them }; 20 21 int main (void) {22 23 int N; // n24 25 scanf ("% d", & N); 26 getchar (); 27/** 28 * Create an array of contact types to store Address Book 29 */30 struct contact contacts [N]; 31/** 32 * enter Address Book 33 */34 int I; 35 For (I = 0; I <n; I ++) {36 scanf ("% S % C % S % s", 37 contacts [I]. name, 38 contacts [I]. birthday, 39 & (contacts [I]. gender), 40 contacts [I]. tel, 41 contacts [I]. mobile); 42 getchar (); 43} 44 45 int K; // k46 int search [11] In the question; // record the number to be queried (serial number) 47 48 scanf ("% d", & K); 49 for (I = 0; I <K; I ++) 50 scanf ("% d ", & search [I]); 51/** 52 * output result 53 */54 for (I = 0; I <K; I ++) {55 if (search [I] <n & search [I]> = 0) // n address books, numbered 0 to n-156 printf ("% S % C % s \ n", 57 contacts [search [I]. name, 58 contacts [search [I]. tel, 59 contacts [search [I]. mobile, 60 contacts [search [I]. gender, 61 contacts [search [I]. birthday); 62 else63 printf ("not found \ n"); 64} 65 66 return 0; 67}

 

It took me a long time to finish this question. (⊙ o ⊙) It took only 10 minutes !!! No (qu) tolerance (TA) Straight (MA) depending on (D), how can 9.6 be good... the question of 10 points has not passed completely, sang Xin...

It is expected that Pat (basic level) will be available tonight.

 

Question link:

Http://pat.zju.edu.cn/contests/basic-programming/%E7%BB%93%E6%9E%84-04

Refer:

Http://www.cnblogs.com/aexin/p/3903375.html? Utm_source = tuicool

 

 

.

 

* Structure-04. Enter and display the address book

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.