You are on page 1of 2

Sin datos

include "stdafx.h"
#include <conio.h>
#include <stdlib>
#include <iostream>
using namespace std;
struct trabajo
{int ano;
char nombre[30];
char estado;
char apellido[30];
};
void reporte(int year, char inicial)
{char letra;
int contador=0;
FILE*ptr;
trabajo reg;
ptr=fopen("trabajo.dat","rb");
if(ptr==NULL)
{cout<<"El archivo no existe ";
}else{fread(&reg,sizeof(reg),1,ptr);
while(!feof(ptr))
{if((reg.ano==year)&&(reg.estado=='N'))
{/*cout<<reg.nombre<<" "<<reg.apellido<<endl;*/
letra=reg.nombre[0];
if(letra==inicial)
{
contador=contador+1;
cout<<letra<<"."<<reg.apellido<<endl;
}
}
fread(&reg,sizeof(reg),1,ptr);
}
cout<<"El numero de resultados encontrados es:"<<contador;
fclose(ptr);
};
int main()
{int ano;
char inicial;
cout<<"Ingresar ano: ";
cin>>ano;
cout<<"Ingresar letra: "
cin>>inicial;
reporte(ano,inicial);
}

Fechas
struct fecha()
{int dia;
int mes;
int ano;
};
struct cliente()
{int codigo;
char nombre[30];
fecha x;
};
int main()
{cliente reg;
reg.x.dia;
}

You might also like