Question: When running the program given, it is supposed to give the output below. However, the program contains erros that prevent it from compiling and/or running.

When running the program given, it is supposed to give the output below. However, the program contains erros that prevent it from compiling and/or running. Correct the program so that it works properly. The output: Please enter 10 integers, positive, negative, or zeros. The numbers you entered are: 2 7 -4 -3 0 7 4 0 -9 -4 There are 6 evens, which includes 2 zeros. The number of odd numbers is: 4

The Program:

#include using namespace std; const int limit = 10; int main () { float counter; int number; int zeros; int odds; int evens; cout << "Please enter " << limit << " integers, " << "positive, negative, or zeros." << endl; cout << "The numbers you entered are:" << endl; for (counter = 1; counter <= limit; counter++) { cin >> number; switch (number / 2) { case 0: evens++; if (number = 0) zeros++;

case 1: case -1: odds++; } } cout << endl; cout << "There are " << evens << " evens, " << "which includes " << zeros << " zeros." << endl; cout << "The number of odd numbers is: " << odds << endl; return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!