I'm having some trouble understanding how to use cin.getline and cin.get. I believe I understand the problem, just trying to figure out how to use them in conjunction possibly to solve a problem.
I'm reading from a text file that's read in through cin through command line.
I created a vector of vectors called spaceStation and I want to load it with characters.For example, here's a small portion of the file
M
4
2
//Possible comments
....
#...
E#..
#...
For this, i read in the first three characters properly just using cin>> to load into a variable. Now I need to create a loop to read these multiple characters in on the same line. 1) I'm supposed to ignore all comments 2) I want to run the while loop until a new line is reached that contains no more information
I created a string s so getline(cin,s) should load the entire lines. My question is should i create a cstring s so i can access the individual characters to load or is there a way to use cin.get() to extract the individual characters of the line received by s.