Create the List.h header file for the following C++ program, and trace showing all output in the order that it appears on the output device (presumably the screen). #include using namespace std; #include "List.h" int main(void) { List sheldon_cooper; List leonard_hofstadter; int i, j; cout<<"Program begins, sheldon and leonard constructed"<
Lists. Create the List.h header file for the following C++
#include <iostream>
using namespace std;
#include "List.h"
int main(void) { List sheldon_cooper;
List leonard_hofstadter; int i, j; cout<<"Program begins, sheldon and leonard constructed"<<endl; if (sheldon_cooper.empty())
cout<<"His friend is Raj Koothrappali"<<endl; else
cout<<"His friend is Penny"<<endl; for (i=4;i<=8;i++)
{cout<<"Inserting "<<i*3+2<<" at location "<<i-4<<endl;
sheldon_cooper.insert(i*3+2,i-4);
cout<<" List is now ";
cout<<sheldon_cooper<<endl;
} leonard_hofstadter=sheldon_cooper; j=3; cout<<"removing position "<<j<<" sheldon is now: "; sheldon_cooper.erase(j); cout<<sheldon_cooper<<endl; j=2; leonard_hofstadter.insert(54,j); cout<<"leonard is now "; cout<<leonard_hofstadter<<endl; cout<<"program ends, buzz off "; return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images