Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- bool matchingValuesTogether(const string array[], int n)
- {
- bool result = true;
- if (n < 1)
- {
- return false;
- }
- else
- {
- for (int i = 0; i < n - 1; i++)
- {
- if (array[i] != array[i + 1])
- {
- for (int c = 0; c < i; i++)
- {
- if (array[i + 1] == array[c])
- {
- result = false;
- }
- }
- }
- }
- }
- return(result);
- }
- int main()
- {
- string b[5] = { "dog", "dog", "cat", "fish", "cat" };
- string c[5] = { "dog", "dog", "cat", "cat", "fish" };
- bool me = matchingValuesTogether(c, 5);
- cout << me << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement