Question: Problem 1 : The following program is supposed to count the number of even numbers and the number of odd numbers in an array of
Problem :
The following program is supposed to count the number of even numbers and the number of odd numbers in an array of integers that a user enters.
However the program has some errors in style, syntax, logic and runtime.
In a text or doc file, give the line numbers that the error or errors occurs and the type of error and a complete
explanation of the error or errors as well as what the correction would be
#include
#include namespace std;
int main
const int evencount;
int oddcount;
int index;
int DATA;
cout "Enter numbers: ;
cin DATA DATA DATA DATA DATA ;
cin DATA data DATA DATA DATA;
for index ; index ; index;
if DATAindex
oddcount;
if DATAindex
evencount;
cout "Number of odds: evencount ;
number of evens: oddcount end;
stop ;
Name your file ProblemYourName.txt or doc where YourName is your name
Rubric: Every error is noted, what type of error, why it is an error, and the correction is noted.
Problem :
A student wrote the following function that was supposed to count the number of times a particular number appeared in an array and
return the count to the calling function. There are many errors in the function, some of them are style errors, and
some of them are programming errors syntax logic, runtime Your job is to identify every error, the type of error,
then fix the error so that the function would work correctly.
double COUNTVALUESinteger array, value
int Howmany;
for i ; i array sizeofarray; i
if arrayi value howmany;
Grading: full credit for a ProblemYourName.doc or ProblemYourName.txt file that outlines each error and identifies the line number, the error, the type of error style syntax, logic, runtime and why it is an error and a ProblemYourName.cpp file with the correct function.
Note:
Zip all your files together and put onto the Moodle. DO NOT put onto your digication eportfolio.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
