First I have a struct
strcuct Ficha{
int resgistro;
float pontuacao;
}Fichas[100];
is the following I will randomly read data but a die always in the list will start with the number that is not integer bound
0.5//pontuação
89933//registro
49494
0.4
87474
0.6
89044
88443
86965
The problem is as follows: 0.5 is the two registers that come down, 0.4 is only 87474 and then comes 0.6 that belongs to the register that have below the score that is logic.
Good as data is in a file txt
Reading
void lerArquvivo(){
ifstream Arquivo;
Arquivo.open("Regeistro.txt");
char linha[10];
float n;
while(Arquivo.getline(linha,10)){
Arquivo >> n;
separa(n);
}
Arquivo.close();
}
Then create a function that separates integer from non-integer.
void separa(floar valor){
int x = valor;
float y = valor;
if(x==y){
//cout<<"Inteiro"<<endl;
}else{
//cout<<"Não e Inteiro"<<endl;
}
}
Here, as I have to store in the vector% wrapper% and% wrapper% I can not do to store in the numbers of the related vector position.
As an example of the problem.
posição do vetor registro pontuação
0 0 0.5
1 89487 0
2 78474 0
3 0 0.4
.
.......