Write a program to input a list of numbers in an array and then rearrange this array in such a way that all the odd numbers appear in the beginning of the array and all the even numbers appear in the end of the array. E.g., if the input list is 1,4,2,7,6,5,9, then after rearrangement the list should be: 1,7,5,9,4,2,6.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.3: Declaring And Processing Two-dimensional Arrays
Problem 3E: (Practice) a. Write a C++ program that adds the values of all elements in the val array used in...
icon
Related questions
Question

(a) Write a program to input a list of numbers in an array and then rearrange this array in such a way
that all the odd numbers appear in the beginning of the array and all the even numbers appear in the
end of the array. E.g., if the input list is 1,4,2,7,6,5,9, then after rearrangement the list should be:
1,7,5,9,4,2,6. 
(b) What does the term cast refer to? Why is it used? Justify your answer by considering a suitable
example.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr