codice:
ifstream in("a.txt");
string tmp;
while(getline(in, tmp)) {
//tmp sarà la riga sempre sucessiva
}
Ti conviene creare un vector<string> ed inserire le varie righe:

codice:
ifstream in("a.txt");
string tmp;
vector<string> v;
while(getline(in, tmp)) {
v.push_back(tmp);
}
cout << v[3];// 4 riga, parte da 0 ovviamente