log in times,time of the eachuser problem for compilate

hello everyone i need help with this code
need a dev c++ program does analyze an archive with the time of use from a platform of web.
the archive have just 2 columns,first one identifier the user and the second time of his log in.
the same user can make a lot of sesion.
we know the total user less than 1709

1 the user with more log on of work
2 make a archive with the total time of each user
3 the user with more total time use(take into consideration every log in)


[Warning] NULL used in arithmetic [-Wpointer-arith]

i dont now what need to change for make it work well,trying to compilate it nothing happen
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include<iostream>
#include<fstream>
#include <stdlib.h> //Atoi change string to int
using namespace std;

int main(){
	int usuarios[1708]; //array structure of 1708 users
	int sesiones[1708];
	for(int i=0;i<1709;i++){
		usuarios[i]=0;
		sesiones[i]=0;  //every user start with 0 minutes and 0 sign
	}
	ifstream fi("tiempoespacios.txt"); //read archive  tiempo.txt	
	string aux; //temporaly save the line
	string aux2="fffff"; //save temporaly the element of the actually line
	int contador_auxiliar; //knew where end the element
	int id_usuario;
	int duracion_usuario;
	string temporal;
	while (!fi.eof() ){
		getline(fi,aux);
		aux2="ffffff";
		for(int i=0;i<10;i++){
			if(aux[i]!=' ' & aux[i]!='	') aux2[i]=aux[i];
			else{
				contador_auxiliar=i+1; //find where end the user
				break;
			}			
		}
		char tmp[contador_auxiliar];
		for(int j=0;j<contador_auxiliar;j++){
			tmp[j]=aux2[j];
		}
		id_usuario=atoi(tmp);
		aux2="ffffff";
		for(int k=0; k<10; k++){
			aux2[k]=aux[contador_auxiliar+k];
		}
		for(int l=0; l<5; l++){
			if(aux2[l]!='f') contador_auxiliar=l;
		}
		char tmp2[contador_auxiliar];
		for(int m=0;m<contador_auxiliar+1;m++){
			tmp2[m]=aux2[m];
		}
		duracion_usuario=atoi(tmp2);
		
		usuarios[id_usuario]=usuarios[id_usuario]+duracion_usuario;
		sesiones[id_usuario]=sesiones[id_usuario]+1;
		//cout<<"Usuario: "<<id_usuario<<" Sesion: "<<usuarios[id_usuario]<<endl;
	}
	
	int user_sesiones=0;
	int user_sesiones_i=0;
	for(int i=0; i<1708; i++){
		if(sesiones[i]>user_sesiones){
			user_sesiones=sesiones[i];
			user_sesiones_i=i;
		}
	}
	cout<<"El usuario con mayor cantidad de sesiones es: "<<user_sesiones_i<<endl;
	
	
	ofstream fo("resultados.txt");
 	for(int i=0; i<1709; i++){
 		if(usuarios[i]==NULL) continue;
 		fo<<"El usuario "<<i<<" tuvo "<<usuarios[i]<<" minutos de sesion."<<endl;
	 }
	 
	int mayor_duracion=0;
	int mayor_duracion_u=0;
	for (int i=0; i<1709; i++){
	 	if(usuarios[i]==NULL) continue;
	 	if(usuarios[i]>mayor_duracion) {
	 		mayor_duracion=usuarios[i];
	 		mayor_duracion_u=i;
	 	}
	}
	cout<<"El usuario con mayor duracion en sesiones es: "<<mayor_duracion_u<<endl;
	fo.close();	
	fi.close();
	return 0;
}
Topic archived. No new replies allowed.