#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

Recommended Answers

All 2 Replies

>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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.