Hi, im new to C++ and im very confused as to why does the getline prints the extra content after I split the string with a delimiter also is there a better way for me to split the string instead of multiple getlines?
Because you are using the same variable in both your getline() functions your program will produce different output depending on whether or not the input file's last line has a new line character or not.
I suggest you put a breakpoint at the while() statement then single step through the loop with your debugger, watching the values of the variables as you step.