matching string with arrays

how would I match a getline() string with alphabet characters in an array
You can compare a string with an array of chars with the equal to operator.

1
2
3
4
std::string testString = "abcd";
char testChars[4] = { 'a', 'b', 'c', 'd' };
if (testString == testChars)
    std::cout << "The string and array of chars are the same.\n";
Topic archived. No new replies allowed.