You are on page 1of 1

.

22. : , - , ,
. ,
- 5- ,
.
#include <stdio.h>
#include <string.h>
#include <conio.h>
#define N 4
void main ()
{
struct motoc
{
char marka[15];
char zavod[15];
float cena;
char nomer_d[15];
}x[N];
FILE *f1,*fv;
char zadan_zavod[15],n;
int i;
float t;
clrscr();
f1=fopen("C:\\User\\in-43\\otv.txt","w");
fv=fopen("C:\\User\\in-43\\vh.txt","r");
printf("vvedite 4islo t=\n");
scanf("%f",&t);
for (i=0;i<N; i++)
{
fscanf(fv,"%s",&x[i].marka);
fscanf(fv,"%s",&x[i].zavod);
fscanf(fv,"%f",&x[i].cena);
fscanf(fv,"%s",&x[i].nomer_d);
}
printf (" =\n");
fflush(stdin);
scanf ("%s",&zadan_zavod);
printf (" =\n");
fflush(stdin);
scanf ("%c",&n);
for (i=0;i<N;i++)
if((strcmp(x[i].zavod,zadan_zavod)==0)&& (x[i].nomer_d[0]==n) && (strlen(x[i].nomer_d)==5))
{
fprintf(f1,"=%s\n =%s\n =%f\n =%s", x[i].marka, x[i].zavod, x[i].cena,
x[i].nomer_d);
printf("=%s\n =%s\n =%f\n =%s", x[i].marka, x[i].zavod, x[i].cena,
x[i].nomer_d);
}
fclose(f1);
fclose(fv);
getch();
}