Question: Complete the following program named prime.cpp, which allows a user to specify a number n in the command line to generate a prime list and

 Complete the following program named prime.cpp, which allows a user to

Complete the following program named prime.cpp, which allows a user to specify a number n in the command line to generate a prime list and then display the prime list. Compile and run your program / prime.cpp include class node f public: l node class int v node next; node(int x)(vx; next-0:) class list f public: // list class node head; node *tail; bool emptyOfreturn lhead; void add(int x); int getO freturn head->v;) listO (head-tail-0:) -listO; // head position // tail position // list is empty or not // add to tail /l get from head // destructor // implement the member function add(int x) and the destructor-list here class primelist : public list( public: int lengthO: int largestO freturn tail->v: void expandO: void display0: primelistO: listO(add(2);3 Il/ return the number of primes in the list // return the largest prime in the list /l add next prime to current list Il display the prime list Il a single entry list implement the member functions length0, expand0, and displayO here int main(int argc, char *argvD t int n= atoi(argv[1]); primelist pl; while(pl.largest0

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!