Question: 1 . Write a c + + program to do the following: a . Generate 1 0 random numbers between 1 0 and 4 0

1.Write a c++program to do the following:
a. Generate 10 random numbers between 10 and 40 and store them in linked list pointed by ALL.
b. Create an algorithm for making changes to the list ALL such that all even numbers appear at the beginning of the list. Use one of the following hints to write your program
HINT 1. While traversing ALL, collect even numbers in list EVEN and odd numbers in list ODD. Now to get the final list, simply append the two lists EVEN and ODD
HINT 2. While traversing ALL, create a NEW list by inserting even numbers in front and odd numbers at the rear of the list
Sample run:
Original list ALL: 20371933243811131924NULL
New list ALL : 24382420371933111319NULL

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!