15,615,787 members
See more:
C++
```
```
Write a C++ program that divides a single LL of integer into two Linked List. Oddllist which includes the odd numbers and evenlist which includes the even numbers.

plz help me:(

What I have tried:

#include <iostream>
using namespace std;
Posted
Updated 29-Sep-21 22:23pm
jeron1 29-Sep-21 17:20pm
It looks like there was an issue posting your code, try editing your post and re-adding your code. Also, try and pinpoint the spot (or spots) in your code that you are having trouble with.
Patrice T 29-Sep-21 17:34pm
You will need a little more code to get help fixing it.
and explanation of the problem.

## Solution 5

Here you are ( :-D )

C++
```#include <iostream>
#include <list>
#include <algorithm>
using namespace std;

int main()
{
list<int> origin{1, 2, 27, 46,- 42, 42, 17, 1, 3, 5, 7, 10, 8, 1024, 32};

list <int> odd;
list <int> even;

copy_if( origin.begin(), origin.end(), back_inserter(odd), [] (int i) { return (i & 1) == 1;});
copy_if( origin.begin(), origin.end(), back_inserter(even), [] (int i){ return (i & 1) == 0;});

for (auto x : origin)
cout << x  << " ";
cout << "\n";

for (auto x : odd)
cout << x  << " ";
cout << "\n";

for (auto x : even)
cout << x  << " ";
cout << "\n";

}```

## Solution 1

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]

## Solution 3

You are learning and homework is training, nobody can do it for you.
Do you think Usain Bolt asked someone to train for him when he was a beginner ?

You show no attempt to solve the problem yourself, you have no question, your main effort is pasting the requirement, you just want us to do your HomeWork.
HomeWork problems are simplified versions of the kind of problems you will have to solve in real life, their purpose is learning and practicing.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.

## Solution 6

My prewriter were all joking but not really helping you. You need to write some code which reads a linked list and add the values to the odd or even list.

Start with some Linked list tutorial to understand the basics. When you have understood the theory than the implementing is a piece of cake. ;-)