Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- bool StringCompare(char[], char[]);
- int main()
- {
- char str1[80], str2[80];
- bool result;
- cout << "Input first string: ";
- cin >> str1;
- cout << "Input second string: ";
- cin >> str2;
- result = StringCompare(str1, str2);
- if(result == true)
- cout << "Strings are equal\n";
- else
- cout << "Strings are not equal\n";
- return 0;
- }
- bool StringCompare(char str1[], char str2[])
- {
- bool result = true;
- for(int index = 0; index < 80 && result; index++) {
- if(str1[index] != str2[index])
- result = false;
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement