void slova(string datoteka){
ifstream coban;
coban.open(datoteka.c_str());
string polje[200];
string linija;
int brojac=0;
while(!coban.eof()){
getline(coban,linija);
polje[brojac]=linija;
brojac++;
}
string rec=polje[1];
int brojac2=0;
for(int i=0;i<rec.length();i++){brojac2++;}
cout<<brojac2<<endl;
if(rec[0]==rec[brojac2]){cout<<"same letters"<<endl;}
else{cout<<"letters are not same"<<endl;}
}
This is my code, it should test if 1st and last letter in string are same, but i can't get it to work.
Please somebody help me, i would really appreciate it.
Thank you in advance.