Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write in C++. Write a function string evenDigits(int x); that returns a string object which retains only the even digits (0, 2, 4, 6, 8)
write in C++.
Write a function string evenDigits(int x); that returns a string object which retains only the even digits (0, 2, 4, 6, 8) of the parameter integer x. For example, the function call evenDigits (2964743) should return a string object with contents "2644"; evenDigits (-689) should return a string object with contents "68";evenDigits (o) should return a string object with contents "O". Note that if x contain odd digits only (e.g., 99571), the the function should return an empty string.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started