I'm writing a program where I have a variety of input commands.
Lets say here are my three commands:
info
playlist #
quit
info - gives me information
quit - terminates the program
The problem:
playlist # - The command playlist # means I need to cout a number of songs according to the size of #.
For example:
Playlist 1
I love you
Playlist 3
I love you
Your a Jerk
Never lie
Playlist 5
I love you
Your a Jerk
Never lie
Jealousy
Ultimate Dilema
and so on.
The problem is the input method.
For example if I use cin >> a >> b;
Then it'll prompt for two inputs even if there should only be one.
e.g info and quit only have one input value.
If I use getline(cin, string)
Then I take all the inputs into consideration, however that means I can't apply playlist # to a function.
Lets say cmdPlaylist(int b)
So my question is how do I split something in the getline?