Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int sameLocation (char str1[], char str2[]);
- int sameLocation (char str1[], char str2[]) {
- int i, count = 0;
- for (i = 0; i < SIZE && str1 != NULL && str2 != NULL; i++) {
- if (str1[i] == str2[i]) {
- count++;
- }
- }
- return count;
- }
- int main() {
- char str1[SIZE], str2[SIZE];
- cout << "first string: ";
- cin.getline(str1, SIZE);
- cout << "second string: ";
- cin.getline(str2, SIZE);
- cout << endl;
- cout << sameLocation (str1, str2) << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement