#include "iostream"
#include <conio.h>
#include <stdio.h>
#include <time.h>
#include <fstream>
#include <stdlib.h>
#define tamf 1
#define tamc 2
using namespace std;
void llenarME(string[], int Hora[][tamc]);
void llenarMS(int Hora[][tamc]);
void mostrarME(string[], int Hora[][tamc]);
int main()
{
string Placa[tamf];
int M[tamf][tamc];
llenarME(Placa,M);
system("pause");
return 1;
}
void llenarME(string placa[], int Hora[][tamc])
{
char resp;
int fila=0,i=0;
cout<<"Placa: ";
cin>>placa[fila];
struct tm *tiempo;
time_t hora_Sistema;
time(&hora_Sistema);
tiempo=localtime(&hora_Sistema);
getch();
Hora[fila][0] =tiempo ->tm_hour;
Hora[fila][1] =tiempo ->tm_min;
printf("Hora de entrada: %d:%d \n",Hora[fila][0],Hora[fila][1]);
fila++;
fflush(stdin);
ofstream archW;
ifstream archR;
for(int i=0;i<tamf;i++)
{
cout<<placa[i]<<"\t";
for(int j=0;j<tamc;j++)
{
printf(" %d \t",Hora[i][j]);
}
printf("\n");
}
archR.open("destino.txt");
archW.open("Base de datos.txt");
if ((archW.fail())or(archR.fail()))
{
cout<<"Error al abrir archivo..."<<endl;
exit(1);
}
else
{
for(int i=0;i<tamf;i++)
{
archW<<placa[i]<<"\t";
cout<<"Se Guardo "<<placa[i]<<"\t";
for(int j=0;j<tamc;j++)
{
archW<<Hora[i][j]<<"\t";
cout<<Hora[i][j]<<"\t";
}
cout<<"\n";
}
archW.close();
}
}
void llenarMS(int Hora[][tamc])
{
int fila=0,i=0;
struct tm *tiempo;
time_t hora_Sistema;
time(&hora_Sistema);
tiempo=localtime(&hora_Sistema);
getch();
Hora[fila][0] =tiempo ->tm_hour;
Hora[fila][1] =tiempo ->tm_min;
printf("Hora de salida: %d:%d \n",Hora[fila][0],Hora[fila][1]);
fila++;
fflush(stdin);
ofstream archW;
ifstream archR;
archR.open("destino.txt");
archW.open("Base de datos.txt");
if ((archW.fail())or(archR.fail()))
{
cout<<"Error al abrir archivo..."<<endl;
exit(1);
}
else
{
for(int i=0;i<tamf;i++)
{
for(int j=0;j<tamc;j++)
{
archW<<Hora[i][j]<<"\t";
cout<<Hora[i][j]<<"\t";
}
cout<<"\n";
}
archW.close();
}
}
basicamente necesito saber como en la funcion cantidad de minutos puedo lleer la hora para calcular la cantidad de minutos transcurridos
Mod: Los códigos deben ir en etiquetas GeSHi, no hagas doble post,, el titulo debe ser descriptivo a la problemática... post corregido