Count_List_Elements

Download Category:

Count_List_Elements_CPP.zip - (7.17 MB)
[
Count_List_Elements_CPP/Count_List_Elements_CPP.cpp
Count_List_Elements_CPP/Count_List_Elements_CPP.sdf
Count_List_Elements_CPP/Count_List_Elements_CPP.sln
Count_List_Elements_CPP/Count_List_Elements_CPP.suo
Count_List_Elements_CPP/Count_List_Elements_CPP.vcxproj
Count_List_Elements_CPP/Count_List_Elements_CPP.vcxproj.filters
Count_List_Elements_CPP/Count_List_Elements_CPP.vcxproj.user
Count_List_Elements_CPP/Debug/
Count_List_Elements_CPP/Debug/cl.command.1.tlog
Count_List_Elements_CPP/Debug/CL.read.1.tlog
Count_List_Elements_CPP/Debug/CL.write.1.tlog
Count_List_Elements_CPP/Debug/Count_List_Elements_CPP.exe
Count_List_Elements_CPP/Debug/Count_List_Elements_CPP.exe.embed.manifest
Count_List_Elements_CPP/Debug/Count_List_Elements_CPP.exe.embed.manifest.res
Count_List_Elements_CPP/Debug/Count_List_Elements_CPP.exe.intermediate.manifest
Count_List_Elements_CPP/Debug/Count_List_Elements_CPP.ilk
Count_List_Elements_CPP/Debug/Count_List_Elements_CPP.lastbuildstate
Count_List_Elements_CPP/Debug/Count_List_Elements_CPP.log
Count_List_Elements_CPP/Debug/Count_List_Elements_CPP.obj
Count_List_Elements_CPP/Debug/Count_List_Elements_CPP.pdb
Count_List_Elements_CPP/Debug/Count_List_Elements_CPP_manifest.rc
Count_List_Elements_CPP/Debug/link.5372.read.1.tlog
Count_List_Elements_CPP/Debug/link.5372.write.1.tlog
Count_List_Elements_CPP/Debug/link.5372-cvtres.read.1.tlog
Count_List_Elements_CPP/Debug/link.5372-cvtres.write.1.tlog
Count_List_Elements_CPP/Debug/link.command.1.tlog
Count_List_Elements_CPP/Debug/link.read.1.tlog
Count_List_Elements_CPP/Debug/link.write.1.tlog
Count_List_Elements_CPP/Debug/link-cvtres.read.1.tlog
Count_List_Elements_CPP/Debug/link-cvtres.write.1.tlog
Count_List_Elements_CPP/Debug/mt.command.1.tlog
Count_List_Elements_CPP/Debug/mt.read.1.tlog
Count_List_Elements_CPP/Debug/mt.write.1.tlog
Count_List_Elements_CPP/Debug/rc.command.1.tlog
Count_List_Elements_CPP/Debug/rc.read.1.tlog
Count_List_Elements_CPP/Debug/rc.write.1.tlog
Count_List_Elements_CPP/Debug/vc100.idb
Count_List_Elements_CPP/Debug/vc100.pdb
Count_List_Elements_CPP/ipch/
Count_List_Elements_CPP/ipch/count_list_elements_cpp-de6ffe72/
Count_List_Elements_CPP/ipch/count_list_elements_cpp-de6ffe72/count_list_elements_cpp-15e90b2e.ipch
Count_List_Elements_CPP/Question.txt
Count_List_Elements_CPP/Screenshot.png
]

Implement a method countValue() that counts the number of times an item occurs in a linked list. Remember to use the STL list.
int countValue(list front, const int item);
Generate 20 random numbers in the range of 0 to 4, and insert each number in the linked list. Output the list by using a method which you would call writeLinkedList which you would add to the ListP.cpp.

In a loop, call the method countValue() , and display the number of occurrences of each value from 0 to 4 in the list.
The above is to be included in a file named ListP.cpp
The following code needs to go in ListP.cpp. The actual code of the function countValue() needs to be included:
int countValue(list front ,const int item);
using namespace std;
int _tmain(int argc, _TCHAR* argv[]){
list front;
int listCount;
cout <> listCount;
for (int i = 1; i <= listCount; i++) front.insert(i,rand()%5); cout << "Original List of Values: " << endl; //writeLinkedList(front, " "); cout << endl; for(int j=0;j<5;++j) cout << countValue (front,j) << endl; cout << endl; return 0; }

Write a Review

Get a fresh solution of this question. Ask it now to our experts.
doubt

Ask Your Question

We have verified professionals who are ready to answer your question.

time

Save Time and Money

We choose experts who can quickly answer your question and that suit your budget.

download

Get Your Answer

Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.