I have two questions. I'm trying to read in line by line from a file but I can't get each line to go individually to where I can use it. Also, I can't figure out how to ask the user for their file name and than use what they type in the program. All the examples I've found just has the name of the file in the code already and just putting it in cin doesn't seem to work. I am trying to separate two different types of lines, so for example, abcd and 1234. If the first value is a letter do case a, if it's a number, do case b. But all I've managed to do is have getline have everything in one so I can't actually separate it. Anyone have any advise?
string x;
cout << "Enter your file: " ;
cin >> x
string line;
ifstream myfile;
myfile.open (x);
while(!myfile.eof())
{
getline(myfile,line, ' ');
}
cout << line << endl;