A simple telephone book management system written in C language and a management system written in C Language

Source: Internet
Author: User

A simple telephone book management system written in C language and a management system written in C Language

# Include <stdio. h>

# Include <string. h>

# Include <stdlib. h>

Int n = 0;

Struct person

{Char name [20];

Char WP [20];

Char PN [20];

Char MPN [20];

Char FZ [20];

Char EM [20];

Char QQ [20];

};

 

Void fun1 (struct person B [100], int B [100])

{Int I = 0;

Int H;

Do

{Printf ("enter the information of the % d contact \ n", I + 1 );

Printf ("enter your name :");

Scanf ("% s", B [B [I]. name); printf ("\ n ");

Printf ("Enter the work address :");

Scanf ("% s", B [B [I]. WP); printf ("\ n ");

Printf ("enter a landline number :");

Scanf ("% s", B [B [I]. PN); printf ("\ n ");

Printf ("Enter the mobile phone number :");

Scanf ("% s", B [B [I]. MPN); printf ("\ n ");

Printf ("Enter your relationship with me :");

Scanf ("% s", B [B [I]. FZ); printf ("\ n ");

Printf ("Enter your email :");

Scanf ("% s", B [B [I]. EM); printf ("\ n ");

Printf ("Enter the QQ number :");

Scanf ("% s", B [B [I]. QQ); printf ("\ n ");

I ++; n ++;

Printf ("1 continue input; 0 exit \ n ");

Scanf ("% d", & H );

} While (H! = 0 );

Printf ("\ n ");

}

 

Void fun2 (struct person F [100], int h [100])

{Int I = 0, t, k, p, m;

T = n/10;

Printf ("the information of all contacts is as follows: \ n ");

If (t = 0)

{For (I = 0; I <n; I ++)

Printf ("Name: % s \ t Unit: % s \ t landline phone: % s \ t mobile phone: % s \ t category: % s \ t Email: % s \ tQQ: % s \ n ", F [h [I]. name, F [h [I]. WP, F [h [I]. PN, F [h [I]. MPN, F [h [I]. FZ, F [h [I]. EM, F [h [I]. QQ );}

Else

{For (k = 0; k <t; k ++)

{For (I = 0; I <10; I ++)

Printf ("Name: % s \ t Unit: % s \ t landline phone: % s \ t mobile phone: % s \ t category: % s \ t Email: % s \ tQQ: % s \ n ", F [h [10 * k + I]. name, F [h [10 * k + I]. WP, F [h [10 * k + I]. PN, F [h [10 * k + I]. MPN, F [h [10 * k + I]. FZ, F [h [10 * k + I]. EM, F [h [10 * k + I]. QQ );

Printf ("input '1' to display next page \ n ");

Scanf ("% d", & p );

If (p = 1)

System ("cls ");}

M = 10 * t;

For (I = 0; m <n; m ++)

Printf ("Name: % s \ t Unit: % s \ t landline phone: % s \ t mobile phone: % s \ t category: % s \ t Email: % s \ tQQ: % s \ n ", F [h [m]. name, F [h [m]. WP, F [h [m]. PN, F [h [m]. MPN, F [h [m]. FZ, F [h [m]. EM, F [h [m]. QQ );}

}

 

Void fun3 (struct person d [2, 100], int e [2, 100])

{Char x [20], p [2];

Int D, I;

Do {int m = 0;

Printf ("enter the information to be searched: \ n ");

Scanf ("% s", & x );

For (I = 0; I <n; I ++)

If (! Strcmp (d [e [I]. name, x) |! Strcmp (d [e [I]. WP, x) |! Strcmp (d [e [I]. PN, x) |! Strcmp (d [e [I]. MPN, x) |! Strcmp (d [e [I]. FZ, x)

|! Strcmp (d [e [I]. EM, x) |! Strcmp (d [e [I]. QQ, x ))

{D = e [I];

Printf ("the contact information to be queried is as follows: \ n ");

Printf ("Name: % s \ t Unit: % s \ t landline phone: % s \ t mobile phone: % s \ t category: % s \ t Email: % s \ tQQ: % s \ n ", d [D]. name, d [D]. WP, d [D]. PN, d [D]. MPN, d [D]. FZ, d [D]. EM, d [D]. QQ );}

Printf ("Enter Y or y to continue the query, enter N or n to exit \ n ");

Scanf ("% s", & p );

} While (! Strcmp (p, "Y") |! Strcmp (p, "y "));

}

 

Void fun4 (struct person c [100], int k [100])

{Char d [20]; char p [2];

Int t [10], j, I, x;

Do {printf ("Enter the contact information to delete: \ n ");

Scanf ("% s", & d );

For (I = 0; I <n; I ++)

If (! Strcmp (d, c [k [I]. name) |! Strcmp (d, c [k [I]. WP) |! Strcmp (d, c [k [I]. PN) |! Strcmp (d, c [k [I]. MPN) |! Strcmp (d, c [k [I]. FZ) |! Strcmp (d, c [k [I]. EM) |! Strcmp (d, c [k [I]. QQ ))

J = k [I];

For (x = j; x <n; x ++)

K [x] = x + 1;

N --;

Printf ("Enter Y or y to continue, enter N or n to exit \ n ");

Scanf ("% s", & p );

} While (! Strcmp (p, "Y") |! Strcmp (p, "y "));

}

 

Void fun5 (struct person B [100], int B [100])

{Int H;

Do

{Printf ("Enter the contact information \ n ");

Printf ("enter your name :");

Scanf ("% s", B [B [n]. name); printf ("\ n ");

Printf ("Enter the work address :");

Scanf ("% s", B [B [n]. WP); printf ("\ n ");

Printf ("enter a landline number :");

Scanf ("% s", B [B [n]. PN); printf ("\ n ");

Printf ("Enter the mobile phone number :");

Scanf ("% s", B [B [n]. MPN); printf ("\ n ");

Printf ("Enter your relationship with me :");

Scanf ("% s", B [B [n]. FZ); printf ("\ n ");

Printf ("Enter your email :");

Scanf ("% s", B [B [n]. EM); printf ("\ n ");

Printf ("Enter the QQ number :");

Scanf ("% s", B [B [n]. QQ); printf ("\ n ");

N ++;

Printf ("1 continue adding; 0 exit \ n ");

Scanf ("% d", & H );

} While (H! = 0 );

Printf ("\ n ");

}

 

Void fun6 (struct person T [2, 100], int r [2, 100])

{Char p [2], d [20];

Int I, t;

Do

{Printf ("Enter the contact information to modify: \ n ");

Scanf ("% s", & d );

For (I = 0; I <n; I ++)

If (! Strcmp (d, T [r [I]. name) |! Strcmp (d, T [r [I]. WP) |! Strcmp (d, T [r [I]. PN) |! Strcmp (d, T [r [I]. MPN) |! Strcmp (d, T [r [I]. FZ) |! Strcmp (d, T [r [I]. EM) |! Strcmp (d, T [r [I]. QQ ))

{T = r [I];

Printf ("Enter the changed contact information \ n ");

Printf ("enter your name :");

Scanf ("% s", T [t]. name); printf ("\ n ");

Printf ("Enter the work address :");

Scanf ("% s", T [t]. WP); printf ("\ n ");

Printf ("enter a landline number :");

Scanf ("% s", T [t]. PN); printf ("\ n ");

Printf ("Enter the mobile phone number :");

Scanf ("% s", T [t]. MPN); printf ("\ n ");

Printf ("Enter your relationship with me :");

Scanf ("% s", T [t]. FZ); printf ("\ n ");

Printf ("Enter your email :");

Scanf ("% s", T [t]. EM); printf ("\ n ");

Printf ("Enter the QQ number :");

Scanf ("% s", T [t]. QQ); printf ("\ n ");

}

Printf ("Enter Y or y to continue, enter N or n to exit \ n ");

Scanf ("% s", & p );

} While (! Strcmp (p, "Y") |! Strcmp (p, "y "));

}

 

Void main ()

{Struct person a [2, 100];

Int A [100], I, X;

For (I = 0; I <100; I ++)

A [I] = I;

Do

{Printf ********** * ************* \ n ");

Printf ("select the operation \ n ");

Printf ("1: Enter the contact information \ n ");

Printf ("2: display all contact information \ n" on the split screen ");

Printf ("3: Finding contact information \ n ");

Printf ("4: Delete contact information \ n ");

Printf ("5: add contact information \ n ");

Printf ("6: modifying contact information \ n ");

 

Printf ("0: Exit \ n ");

Scanf ("% d", & X );

Switch (X)

{Case 1: fun1 (a, A); break;

Case 2: fun2 (a, A); break;

Case 3: fun3 (a, A); break;

Case 4: fun4 (a, A); break;

Case 5: fun5 (a, A); break;

Case 6: fun6 (a, A); break;

 

}

} While (X! = 0 );

}

Related Article

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.