haalp! Class and store data

Im making a project and its about a parking area for cars with several floors, line and columns.
I created a class called Carro ([ENG] Car ) and i whant it to register the license plate, entrance and exit time

I tried to use linked list, but i cant make it work, theres any other solution?
Also need to make a log file, theres any option so i can use only a file to store and read the data?

Carro.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#pragma once

class Carro
{
public:
	
	char matricula;									//Licence Plate
	int hora_entrada, minuto_entrada, hora_saida, minuto_saida;                     //Hour_Entrance,Minute_Entrance,Hour_Exit,Minute_Exit
	int piso, linha, fila;								//Floor,Line,Column
	//
	void CalculaPreco(int, int, int, int) const;//Preco		                // Calculates Price per Hour
	void Entrada(); //Entrada do Carro						// Save the entrance time and licence plate
	void Saida(); //Saida do Carro							// Check if licence plate is registed and save the exit time
	//	
};


Carro.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
void Carro::CalculaPreco(int hora_entrada, int hora_saida, int minuto_entrada, int minuto_saida) const
{
	float hora_f = ((hora_saida - hora_entrada) * 60) + (minuto_saida - minuto_entrada); //makes the diference between times
	float preco, aux;                                                                    //Final Price, random name variable

	//Primeira Hora
	if (hora_f <= 60)
	{
		aux = hora_f / 15;
		preco = aux * 0.4;
		cout << preco;
	}
	//Segunda Hora
	if (hora_f > 60 && hora_f <= 120)
	{
		aux = hora_f / 60;
		preco = aux * 1.0;
		cout << preco;
	}
	//Terceira - Decima Hora
	if (hora_f > 120 && hora_f <= 660)
	{
		aux = hora_f / 60;
		preco = aux * 0.5;
		cout << preco;
	}
	//Decima Primeira + Hora
	if (hora_f > 660)
	{
		aux = hora_f / 60;
		preco = aux * 0.25;
		cout << preco;
	}
	//
}

void Carro::Entrada() //Entrance
{
}

void Carro::Saida() //Exit
{
}


I tried to use linked list, but i cant make it work, theres any other solution?
Use vector. See:

http://www.cplusplus.com/reference/vector/vector/?kw=vector


Also need to make a log file, theres any option so i can use only a file to store and read the data?
You may use fstream. See:

http://www.cplusplus.com/reference/fstream/fstream/?kw=fstream

Alternatively boost:

http://www.boost.org/doc/libs/1_61_0/libs/log/doc/html/index.html
Topic archived. No new replies allowed.