Hey! I have no code to put here, because I don't really know where to start.. :(
But my problem is this - I need to make a programm, that gets a file with some lines of text (There are topics with IDs in frot of them, and then each line starts with a topics ID followed by one word), and I need the programm to sort the text and put it in a different file like this - to topic wothout the "" and in the next like all the words, that had the topics ID in front.
Should I use a sided-list? And if so, how can I assing the according line to the node??
Can someone PLEASE give me some advice on, how to achieve this? I know it's not good that I have no code, bet I'm a begginer, so...yeah :/
Yeah, I actually was reading that before. I made somethng like this. This actually does something - it copies the first files text into the second file. That I got, but all the next is a mystery to me...
// reading a text file
#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
int main () {
string line;
ifstream myfile ("example.txt");
if (myfile.is_open())
{
while ( getline (myfile,line) )
{
cout << line << '\n';
// You will have to do extra stuff here, but for now just get
// each line printing to your screen.
}
myfile.close();
}
else cout << "Unable to open file";
return 0;
}
Once you're printing lines to the screen from your file, make sure you understand all the functions in the example as well.