[HELP] Sentinel Controlled Dynamic Array

Feb 16, 2018 at 5:19pm
Hello friends, someone help me please!

Write a code to take integer input in 2 dynamic arrays as long as the user doesn't enter sentinel value. After you have finished taking input for one dynamic array start for the second. Their size depends on after entering how many elements the user enters the sentinel value and their size may be different. Now pass the 2 dynamic arrays through a function after which all the odd numbers of both arrays are in 1st dynamic array and all the even numbers of both the dynamic arrays are in 2nd array.

Feb 16, 2018 at 6:29pm
1
2
3
4
5
6
std::vector<int> v1, v2;
int n;
while(std::cin>>n and n not_eq centinel)
   v1.push_back(n);
while(std::cin>>n and n not_eq centinel)
   v2.push_back(n);
Topic archived. No new replies allowed.