#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main() {
string helped;
string helped2;
int x = 0;
ifstream read;
read.open("txt.txt");
if (read.good() == false) cout << "false";
while (!read.eof()) {
x++;
getline(read, helped);
if (x == 5) helped2 = helped;
}
read.close();
return 0;
}
Masz tu przykładowy kod pisany na szybko, ale można by było go poskracać zapewne, ino nie chciało mi się główkować, bynajmniej będziesz mógł coś też pomyśleć ;)
Biblioteka fstream:
https://www.youtube.com/watch?v=0LIYtlLfNCY
https://www.youtube.com/watch?v=T8HJQ_XPNKk
Polecam tego nauczyciela ;)