subject

Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither. The input begins with an integer indicating the number of integers that follow.

Ex: If the input is:

5 2 4 6 8 10

the output is:

all even

Ex: If the input is:

5 1 3 5 7 9

the output is:

all odd

Ex: If the input is:

5 1 2 3 4 5

the output is:

not even or odd

Your program must define and call the following two functions. IsVectorEven returns true if all integers in the array are even and false otherwise. IsVectorOdd returns true if all integers in the array are odd and false otherwise.
bool IsVectorEven(vector myVec)
bool IsVectorOdd(vector myVec)

#include
#include
using namespace std;

/* Define your function here */

int main() {
/* Type your code here. */

return 0;
}

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:00, seddy86
Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". any value that is the same as the immediately preceding value is considered a consecutive duplicate. in this example, there are three such consecutive duplicates: the 2nd and 3rd 5s and the second 6. note that the last 3 is not a consecutive duplicate because it was preceded by a 7. write some code that uses a loop to read such a sequence of non-negative integers , terminated by a negative number. when the code finishes executing, the number of consecutive duplicates encountered is printed. in this case, 3 would be printed. assume the availability of a variable, stdin, that references a scanner object associated with standard input. that is, stdin = new scanner(system. in); is given.
Answers: 1
image
Computers and Technology, 22.06.2019 20:00, jayjay5246
What is the term for water wave that is created by an underwater earthquake
Answers: 1
image
Computers and Technology, 23.06.2019 00:30, Thisisdifinite
Which of the following would you find on a network
Answers: 3
image
Computers and Technology, 23.06.2019 02:00, HannahVance99
In the context of an internet connection, llc stands for leased line connection liability limited company local loop complex local loop carrier
Answers: 1
You know the right answer?
Write a program that reads a list of integers, and outputs whether the list contains all even number...

Questions in other subjects: