 
        
        
          Добавил:
          
          
        
        
    
            korayakov
            
            
            
            
            
            Опубликованный материал нарушает ваши авторские права? Сообщите нам.
          
          Вуз:
          Предмет:
          Файл:Прочее / Задачи для экзамена по С++ / Еще задачи (2004) / Гаишники
.CPP#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
const n=4;
int s=0;
int i;
 struct gai{
 char fio[30];
 char adres[40];
 char color[20];
 char nomer[10];
 char marka[20];};
gai *nai(gai x[])
 {int k=0;
 gai *res;
 for (int i=0;i<n;i++)
  if (!strcmp(x[i].fio,"a")) s++;
 res=new (gai[s]);
 for (i=0;i<n;i++)
 {
   if (!strcmp(x[i].fio,"a"))
    {  strcpy(res[k].fio,x[i].fio);
	  k++;}
 }
 delete(res);
 return res;
 };
void main()
{
 clrscr();
 gai mas[n],*rmas;
 int i,a;
 strcpy(mas[0].fio,"a");
 strcpy(mas[1].fio,"b");
 strcpy(mas[2].fio,"a");
 strcpy(mas[3].fio,"a");
rmas = nai(mas);
for (i=0;i<s;i++) puts(rmas[i].fio);
getch();
}
          Соседние файлы в папке Еще задачи (2004)
          
      
    
    
    
          