Group B Q1) A vector is given by x-[-3.5-5 6.2 11 08.1-903-13 2.5]. Using conditional statements and loops, write a program that creates two vectors from x-one (call it P) that contains the positive elements of x, and a second (call it N) that contains the negative elements of x. In both P and N, the elements are in the same order as in x.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question
Group B
Q1) A vector is given by x = [-3.5-5 6.2 11 0 8.1-903-132.5]. Using conditional statements and loops,
write a program that creates two vectors from x-one (call it P) that contains the positive elements of x,
and a second (call it N) that contains the negative elements of x. In both P and N, the elements are in the
same order as in x.
Transcribed Image Text:Group B Q1) A vector is given by x = [-3.5-5 6.2 11 0 8.1-903-132.5]. Using conditional statements and loops, write a program that creates two vectors from x-one (call it P) that contains the positive elements of x, and a second (call it N) that contains the negative elements of x. In both P and N, the elements are in the same order as in x.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Declaring and Defining the Function
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++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning