I have problem while getting first word of each line in my file. My txt file is:
GB LONDON 1 9 3 0 4 5
D BERLIN 2 5 6 1 4 
E MADRYT 1 2 3 4 5 
And I want only to put first word each line of file to array like [GB,D,E]; I tried this:
ifstream plik("galerie.txt");
    
    if(!plik){
        
        
        cout<<"not working";
    }
    
    string city[50];
    int n=0;
    while(plik.eof()){
        plik>>city[n];
    
        n++;
    
    }
    plik.close();
But it gets me every string in line like: GB,LONDON,1,9...
 
     
     
     
    