Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

лабораторные работы / структура

.docx
Скачиваний:
25
Добавлен:
28.01.2014
Размер:
62.22 Кб
Скачать

#include "stdafx.h"

#include "conio.h"

#include "stdio.h"

#include "locale.h"

#include "stdlib.h"

#include "string.h"

struct tel

{

char name[30];

char address[30] ;

int number;

};

struct tel tel1[8];

void main ()

{

setlocale (LC_ALL, "Rus");

strcpy(tel1[0].name,"Аристов Т.К.");

strcpy(tel1[0].address,"Ленина 11-10");

tel1[0].number=467983;

//

strcpy(tel1[1].name,"Бородулин П.В.");

strcpy(tel1[1].address,"Каховская 58-9");

tel1[1].number=333897;

//

strcpy(tel1[2].name,"Гутников В.И.");

strcpy(tel1[2].address,"Каховская 9-31");

tel1[2].number=642009;

//

strcpy(tel1[3].name,"Ермакова А.Н.");

strcpy(tel1[3].address,"Шевченко 7-11");

tel1[3].number=333987;

//

strcpy(tel1[4].name,"Соколов А.В.");

strcpy(tel1[4].address,"Ленина 98-1");

tel1[4].number=256490;

//

strcpy(tel1[5].name,"Седова М.Г.");

strcpy(tel1[5].address,"Шевченко 6-18");

tel1[5].number=334249;

//

strcpy(tel1[6].name,"Сарайкина Е.В.");

strcpy(tel1[6].address,"Каховская 7-37");

tel1[6].number=332072;

//

strcpy(tel1[7].name,"Неумоина Т.В.");

strcpy(tel1[7].address,"Шевченко 9-15");

tel1[7].number=641801;

printf("Ф.И.О \t\t");

printf("адрес \t\t\t");

printf("номер телефона \t\n");

printf("\n");

int i;

for (i=0; i<=7; i++)

{

printf("%s \t", tel1[i].name);

printf("%s \t", tel1[i].address);

printf("%i \t\n", tel1[i].number);

}

printf ("\n");

int p,d;

printf ("Введите 2 первые цифры заменяемого номера:", p);

scanf ("%d", &p);

printf ("Введите 2 заменяющие цифры:", d);

scanf ("%d", &d);

printf ("\n");

for(i=0; i<8; i++)

{

if(tel1[i].number/10000 == p)

tel1[i].number = tel1[i].number - p*10000 + d*10000;

printf("%s \t", tel1[i].name);

printf("%s \t", tel1[i].address);

printf("%i \t\n", tel1[i].number);

}

getch ();

}

Соседние файлы в папке лабораторные работы