dimanche 17 octobre 2021

My if stateent is not working while reading file

In this code I dont know why but if (temp == '\n') is not working therefore in output there is all zeros and that zeros in ith index doesnt update

while(fin.eof() != 1)
{
    
    
    if(temp ==  '\n' ) 
     {
        k = 0;
        j = 0;
        i++;
        cout << "call from 2nd if";     
    }
        
        
        
        if(temp == ',')
         {
            k = 0;
            j++;
            cout << "call from 1st if";
            
            
 
             
         }
            
        
    fin >> temp; 
    data[i][j][k] = temp;
    
    cout << "address " << i << j << k << " : " << data[i][j][k] << endl;
    k++;
    i,j;
}

OUTPUT:

   address at **0**31 : u
   address at **0**32 : i
   address at **0**33 : c
   address at **0**34 : e
   address at **0**35 : B
   .
   .
   .

basically it is 3dimesnional array where i th value is not updating ,what is solution to this

Aucun commentaire:

Enregistrer un commentaire