i got a problem over there. When i use the function below, i got a duplicate of the last entry in my agenda (array of records, "contact"s). How can i resolve this problem? Sorry if i asked a Q previously answered
void load(agenda a,int& r){
    r=0;
    contact c;
    fstream f;
    f.open("agenda.txt",ios::in);
    if(!f)
        cout<<"\nError!";
    else
        while(!f.eof()){
            f>>c.name;
            f>>c.number;
            strcpy(a[r].name,c.name);
            strcpy(a[r].number,c.number);
            r++;
        }
    f.close();
}
 
    