Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Exercise #1: Number of Matches Write a function named number_of matches that compares the initial parts of two character arrays to see how many

C++
image text in transcribed
Exercise #1: Number of Matches Write a function named "number_of matches" that compares the initial parts of two character arrays to see how many pairs of cells match before a difference occurs. For example, if the arrays are: 0 1 2 3 4 5 0 1 23 4 he a v e n and he a v y then the function should return the value 4 because only the first four pairs of cells in the arrays match (cell 0 matches cell O, cell 1 matches cell 1, cell 2, and cell 3). Each of the character arrays will end with the NUL terminator denoted by 0'.The pairwise cell comparisons should not go beyond the end of either array. If the two arrays are identical all the way to their terminating NUL characters, the main program should tell that, and return the number of non-NUL characters. The function should take only two parameters, namely the two-character arrays to be compared. Sample input/output: Enter the first string: heaven Enter the secong string: heavy The number of matching characters between the two strings is: 4 Enter the first string: hello Enter the secong string: hello The two strings are equal and the number of non-null characters is: 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago