Answered step by step
Verified Expert Solution
Link Copied!

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

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

Step: 3

blur-text-image

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

Students also viewed these Databases questions

Question

Why do mergers and acquisitions have such an impact on employees?

Answered: 1 week ago

Question

2. Describe the functions of communication

Answered: 1 week ago