Linked List Creation and Manipulation in C++: A Comprehensive Guide

  • Thread starter Thread starter heavyc
  • Start date Start date
AI Thread Summary
To create a linked list in C++, generate 10 random numbers between 1 and 5 and insert them into nodes in the appropriate position. A function is needed to count occurrences of each number and to delete duplicates, ensuring only unique values remain. Sorting the linked list after removing duplicates is also required. The discussion highlights confusion due to differences between C++.NET and C++ 6.0, though the syntax remains largely the same. Assistance is sought to get started on this project effectively.
heavyc
Messages
16
Reaction score
0
i was wondering if anyone can help me with linked lists?
I have to create a linked list with 10 random numbers rangeing from 1-5 and insert them into a node in the appriote postion of a linearly linked list and display the number of times each number of occurences of each item. and i have to create a function that would delete the replicate items in the linked list and only leave one of the same numbers. and then display the linked list sorted and unique.

I am having trouble starting this out because my teacher sucks and the book is horrible. I have tried help from computer people but it is still not sticking. I am sure if someone can help me get started i can probably get the rest done but i have no idea to get this started because i have only used c++.net and the teacher wants it done in c++6.0 so that is some of the trouble i am having so if someone can help i would be grateful.
 
Physics news on Phys.org
um...C++ in .net is virtually the same as in 6.0. The syntax has not changed. Use the random function in <cmath> to generate random numbers. Are you using standard template library or creating this from scratch?
 
Thread 'Variable mass system : water sprayed into a moving container'
Starting with the mass considerations #m(t)# is mass of water #M_{c}# mass of container and #M(t)# mass of total system $$M(t) = M_{C} + m(t)$$ $$\Rightarrow \frac{dM(t)}{dt} = \frac{dm(t)}{dt}$$ $$P_i = Mv + u \, dm$$ $$P_f = (M + dm)(v + dv)$$ $$\Delta P = M \, dv + (v - u) \, dm$$ $$F = \frac{dP}{dt} = M \frac{dv}{dt} + (v - u) \frac{dm}{dt}$$ $$F = u \frac{dm}{dt} = \rho A u^2$$ from conservation of momentum , the cannon recoils with the same force which it applies. $$\quad \frac{dm}{dt}...
Back
Top