Question
C++ Hello, hope all is well. CAN YOU PLEASE SEE THE SAMPLE OUTPUT AND THE PROGRAM BELOW. PLEASE HELP TO MAKE SURE THIS IS THE
C++
Hello, hope all is well.
CAN YOU PLEASE SEE THE SAMPLE OUTPUT AND THE PROGRAM BELOW. PLEASE HELP TO MAKE SURE THIS IS THE MOST EFFICIENT WAY....PLEASE ADVISE AND LET ME KNOW OF ANY CHANGES TO MAKE THIS PROGRAM MORE EFFICIENT BY USING LESS MEMORY....
// Sample OUTPUT
MENU
1. Calling extractSmallestEvenDigitInfoYourName()
2. Quit
Enter an integer for option + ENTER: 6
Wrong Option!
MENU
1. Calling extractSmallestEvenDigitInfoYourName()
2. Quit
Enter an integer for option + ENTER: 1
How many integers? 3
Enter integer #1: 1004
Enter integer #2: -2111
Enter integer #3: 80645
The original array:
1004
-2111
80645
Calling extractDigitExistenceInfoYourName()
After the function completed and returned the info
The smallest even digit is 0; and 0 is seen 3 time(s) in the following values:
1004 8
0645
MENU
1. Calling extractSmallestEvenDigitInfoYourName()
2. Quit
Enter an integer for option + ENTER: 1
How many integers? 4
Enter integer #1: 1004
Enter integer #2: -2111
Enter integer #3: 602400
Enter integer #4: 80645
The original array:
14
-2111
24
8452
Calling extractDigitExistenceInfoYourName()
After the function completed and returned the info
The smallest even digit is 2; and 2 is seen 3 time(s) in the following values:
-2111
24
8452
MENU
1. Calling extractSmallestEvenDigitInfoYourName()
2. Quit
Enter an integer for option + ENTER: 1
How many integers? 5
Enter integer #1: 1
Enter integer #2: -3
Enter integer #3: 5
Enter integer #4: -7
Enter integer #5: 9
The original array:
1
-3
5
-7
9
Calling extractDigitExistenceInfoYourName()
After the function completed and returned the info
There are no even digits.
#include
void resetCounters(int count[], int range) {/* Reset the count for the previous counters, when another small even integer is found */ for(int i = 0; i < range; i++) count[i] = 0; }
void extractSmallestEvenDigitInfoYourName(int arr[], int size) { int *count = new int [size]; resetCounters(count, size); int minEvenVal = -1; for(int i = 0; i < size ; i++) { /*If a new small digit is found, then reset previous small digit counters to zero */ if(true == extractEvenDigitCount(arr[i], minEvenVal, count[i])) resetCounters(count, i); } int totalCount = 0; for(int i=0;i int main() { int choice, size, *arr; while(1) { cout<<"MENU"<
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