![]() |
|
|
Регистрация Восстановить пароль |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
![]() |
|
Опции темы
![]() |
Поиск в этой теме
![]() |
![]() |
#1 |
Новичок
Джуниор
Регистрация: 08.04.2012
Сообщений: 1
|
![]()
# include <stdio.h>
void view_contacts () /просмотр { int a, i, n=0; scanf ("%d",&a); if (a==1) { for (i=0;i<(n+1);i++) { if (A[i].mobile!=10101) { printf ("Name:%s; Surname:%s; mob:%ld\n",A[i].Name,A[i].Surname,A[i].mobile); } } } } void new_contacts () /добавление контактов { int n=1; if (a==2) { n=n+1; printf("enter Name; Surname; mobile"); scanf("%s%s%ld",&A[n].Name,&A[n].Surname,&A[n].mobile); } } void delete_contacts () /удаление и сорт контактов { int a, i, m=0; scanf ("%d",&a); if (a==3) { for (i=0;i<(n+1);i++) { printf ("%d)Name:%s; Surname:%s; mob:%ld\n",(i+1),A[i].Name,A[i].Surname,A[i].mobile); printf ("do you want to delete a contact by\n1. name\n2. surname\n3. phone number\n4.contact number?\n5. all infomation"); if (a==1) { printf ("what number of contact you want to delete"); printf ("Name:%s\n",.Name,A[i]); scanf ("%d",&m); A[m-1].mobile=10101; } if (a==2) { printf ("what number of contact you want to delete"); printf ("NSurname:%s\n",.Surname,A[i]); scanf ("%d",&m); A[m-1].mobile=10101; } if (a==3) { printf ("what number of contact you want to delete"); printf ("contact number\n",A[i]); scanf ("%d",&m); A[m-1].mobile=10101; } if (a==4) { printf ("what number of contact you want to delete"); printf ("mob:%ld\n",.mobile); scanf ("%d",&m); A[m-1].mobile=10101; } if (a==5) { printf ("what number of cntact you want to delete"); printf ("%d)Name:%s; Surname:%s; mob:%ld\n",(i+1),A[i].Name,A[i].Surname,A[i].mobile); scanf ("%d",&m); A[m-1].mobile=10101; } } } } void quit () /выхода из проги { int a, i, m=0; scanf ("%d",&a); if(a==4) { /это отвечает за вылет из проги } } void help () /гид по проге просьба сделать как в tip 2.1. чтобы отвергало при добавлении новых контактов другие номера { int a;int b=0; { printf("1. Some tips about using Adressbook\n2. Some tips about mobile numbers\n3. Tip about exit"); if (a==1) { printf ("Tip 1.1 : enter the number in the beginning of the string to take appropriate action"); printf ("Tip 1.2 : you can view,add,delete contacts"); printf ("Tip 1.3 : also you can leave programm\n*how you can do this you can read in 3rd tip*"); printf ("Tip 1.4 : you can delete contacts by name,surnames,numbers,or they numbers in Adressbook"); } if (a==2) { printf ("tip 2.1 : You can enter only the numbers that correspond to the form +7-***-***-**-** or 8-***-***-**-**"); } if (a==3) { printf ("Tip 3.1 If you want to quit programm enter 4 in mane menu\n*you must be sure that you want to leave programm because if you leave information wouldn`t be saved*"); } } } int main () { int a, i, n=1, m=0; struct AdressBook { char Name[50]; char Surname[50]; long mobile; } printf ("Adressbook"); printf ("Enter command /help to see tips"); printf ("1. view adress book\n2. add new contacts\n3. delete contacts\n4. exit"); AdressBook A[50]; sprintf (A[0].Name,"%s","Юлия"); sprintf (A[0].Surname,"%s","Валериевна"); A[0].mobile=89636336934; sprintf (A[1].Name,"%s","Гоген"); sprintf (A[1].Surname,"%s","Солнцев"); A[1].mobile=89637840754; view_contacts(A) new_contacts(A) delete_contacts(A) help() quit() getchar(); scanf("%d",&A[i]); return 0; } |
![]() |
![]() |
![]() |
#2 |
Форумчанин
Регистрация: 29.09.2010
Сообщений: 636
|
![]()
кул стори бро
|
![]() |
![]() |
![]() |
![]() |
||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Просьба помочь с задачкой:) | ssnnqq | Паскаль, Turbo Pascal, PascalABC.NET | 2 | 31.03.2012 21:29 |
Просьба помочь! С++/С# | Lihoj | Фриланс | 0 | 08.12.2011 02:49 |
Просьба помочь | Ditmar | Microsoft Office Word | 1 | 28.04.2010 13:11 |
Просьба помочь с задачей. | kry | Паскаль, Turbo Pascal, PascalABC.NET | 9 | 11.01.2009 13:53 |
Можете помочь с задачкой? | Fitness | Паскаль, Turbo Pascal, PascalABC.NET | 2 | 26.12.2007 17:46 |