Do
Solution to Programming Project 4.8
bool containsDigit(int number, int digit);
If number contains digit, then the function should return true. Otherwise, the function should return false. Your program should use this function to find the closest numbers that can be entered on the keypad.
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Problem Solving with C++ (9th Edition)
Additional Engineering Textbook Solutions
Concepts of Programming Languages (11th Edition)
Java How To Program (Early Objects)
Java: An Introduction to Problem Solving and Programming (7th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Artificial Intelligence: A Modern Approach
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
- Give an example from your own idea, of a program that use a void function (does not return avalue), based on your understanding. (You must include a main function)arrow_forwardWrite a function that asks the user for their birthday month and day and then the function should call a nested function to find out the person’s zodiac sign. Test your program with some user input. Aries: March 21 - April 19 Taurus: April 20 – May 20 Gemini: May 21- June 21 Cancer: June 22- July 22 Leo: July 23 – August 22 Virgo: August 23 – September 22 Libra: September 23 – October 23 Scorpio: October 24 – November 21 Sagittarius: November 22 – December 21 Capricorn: December 22 – January 19 Aquarius: January 20 – February 18 Pisces: February 19 – March 20arrow_forwardIn C, write a function that gets two ints a and b. If a>b the function returns a^3 + b^2, and otherwise it returns a^2 + b^3. int square_cube (int a, int b); For example: square_cube (1,2) should return 1 + 8 = 9. square_cube (10, 3) should return 1000 + 9 = 1009. square_cube (2, -1) should return 8 + 1 = 9. square_cube (-2, -1) should return 4 - 1 = 3.arrow_forward
- Suppose that you have the following function definition. int find(int x, int y){return (x + y - x * y);}Consider the following declarations:int list1[10], list2[10], list3[10];int u, v;In the following statements, which function call is valid?a. u = find(list1[0], v);b. cout << find(list1[0], list2[9]) << endl;c. cout << find(list1, list2) << endl;d. for (int i = 0; i < 10; i++)list3[i] = find(list1[i], list2[i]);arrow_forwardWrite a function argument_count that accepts an integer i, followed by any number of additional arguments. The function should returnTrue if the value given to i is equal to the number of arguments that follows it, and should return False otherwise.arrow_forwardWrite a function NumberOfPennies() that returns the total number of pennies given a number of dollars and (optionally) a number of pennies. Ex: 5 dollars and 6 pennies returns 506. #include <iostream>using namespace std; void NumberOfPennies(int NumberOfDollars, int NumberOfPennies){if (NumberOfDollars == 1) {NumberOfDollars = NumberOfPennies * 100;}}/* Your solution goes here */ int main() {cout << NumberOfPennies(5, 6) << endl; // Should print 506cout << NumberOfPennies(4) << endl; // Should print 400return 0;} Please help me with this problem using c++.arrow_forward
- C++ Write a program that uses the function isPalindrome given in Example 6-6 (Palindrome). Test your program on the following strings: madam, abba, 22, 67876, 444244, trymeuemyrtModify the function isPalindrome of Example 6-6 so that when determining whether a string is a palindrome, cases are ignored, that is, uppercase and lowercase letters are considered the same. The isPalindrome function from Example 6-6 has been included below for your convenience. bool isPalindrome(string str) {int length = str.length(); for (int i = 0; i < length / 2; i++) {if (str[i] != str[length – 1 – i]) {return false;} // if } // for loopreturn true;}// isPalindromeYour program should print a message indicating if a string is a palindrome: madam is a palindromearrow_forwardSee attached photo for prompt: a) Write a Python function called func_xy that takes values x and y as arguments and returns the appropriate value of f(x,y). b) Demonstrate that the function works for all relevant cases by inputting different example values.arrow_forwardplease code in python Write a function that receives a string as an input and returns the most frequent letter from the given string. Your solution should be case insensitive, so a capital letter (like A) and its non-capital version (a) should be counted as the same letter. In the given string there can be spaces as well, but your solution shouldn’t count spaces. If there are multiple letters with the same occurrence, you can decide which one to return.arrow_forward
- Write a program that contains a main function and a custom, void function named show_larger that takes two random integers as parameters. This function should display which integer is larger and by how much. The difference must be expressed as a positive number if the random integers differ. If the random integers are the same, show_larger should handle that, too. See example outputs. In the main function, generate two random integers both in the range from 1 to 5 inclusive, and call show_larger with the integers as arguments.arrow_forwardThe correct prototype for the following function heading is void F1(Int &p1, double &p2. bool &p3) void F1(int p1, double p2, bool p3); B void F1(double &p2, bool &p3, int &p1); C void F1(int &p1, double &p2, bool &p3); void F1(int, double , bool):arrow_forwardImplement a function that checks if a number is within a given range. It should accept the range (minimum value and maximum value) and the value to be checked (Xmin ≤ X ≤ Xmax). The function will return true if the given value is within that range, otherwise will return false. (Please write C++ code)arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr