#include <iostream>
#include <cstring>
using namespace std;
bool equalStrings (char[], char[]); //given here but must complete
                                  // on midterm

int main()
{
    char str1[80];
    char str2[80];
    cout << "Enter your first string: " << endl;
    cin.getline(str1);
    cout << "Enter your second string: " << endl;
    cin.getline(str2);
    if (equalStrings (str1, str2) ) //on mt fill in call
        cout << "The two strings are identical." << endl;
    else
        cout << "The two strings are NOT identical." << endl;
}


//Write the function header and body of equalStings
/*

Sample Runs;

Enter your first string; hello--- //-means blank
Enter you second string; hello
The two strings are NOT identical

Sample Runs;
Enter your first string; jon
Enter you second string; joN
The two strings are NOT identical

Sample Runs;
Enter your first string; jane doe
Enter you second string; jane doe
The two strings are identical

Edited 3 Years Ago by Reverend Jim: Fixed formatting

>use memcmp
Brilliant! No, not really. If not being able to use strcmp is a requirement of the function then clearly it's homework and using memcmp would result in a failing grade.

However, I won't make a suggestion other than looping over the contents of both arrays and making comparisons because the OP didn't show an honest attempt at writing the function. It isn't terribly difficult if you expend a little energy trying.

This article has been dead for over six months. Start a new discussion instead.