Problem 2: Write a function called digitMatch.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.3: Returning Multiple Value
Problem 5E
icon
Related questions
Question
Problem 2: Write a function called digitMatch. The function has three integer parameters first , second and
third that are positive and have the same number of digits. It returns the number of positions where their digits
match. For example, if the function was applied to 17345, 97813 and 17313 it would return 1 because only the
2nd digits match. If parameters have illegal values your function can operate however you choose.
For example, a program that uses the function follows.
int main() {
cout <« digitMatch(168, 567, 767) « endl; // prints 1
cout <« digitMatch(143, 243, 343) « endl; // prints 2
return 0;
}
Transcribed Image Text:Problem 2: Write a function called digitMatch. The function has three integer parameters first , second and third that are positive and have the same number of digits. It returns the number of positions where their digits match. For example, if the function was applied to 17345, 97813 and 17313 it would return 1 because only the 2nd digits match. If parameters have illegal values your function can operate however you choose. For example, a program that uses the function follows. int main() { cout <« digitMatch(168, 567, 767) « endl; // prints 1 cout <« digitMatch(143, 243, 343) « endl; // prints 2 return 0; }
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning