I need to compare 2 (or more) string/char inputs and store them in a vector.
For example, "I love mondays"
and "I love mondays"
should return true.
the problem is that for a string input, strcmp()
does not work because it needs char.
But if the input is the type char array it does not register the spaces and only stores the "I"
.
so I tried with cin.getline()
but it did not work properly in a loop.
so I used cin.ignore()
in the loop and everything works fine!
...except now the inputs ignores the first character (result: " love mondays"
).