class List
{
public:
int item;
int pos=0;
List* nextNode;
};
void Insert_Element(List** head, char data)
{
List* node = new List();
node->item = data;
node->nextNode = (*head);
(*head) = node;
}
void PrinList(List *node){
List *temp = node;
while(temp !=NULL){
cout<<temp->item<<" ";
node->pos ++;
temp = temp->nextNode;
}
cout<<"\n";
}
int Length(List *node){
return node->pos;
}
bool is_Empty(List *node){
if(node->pos==0){
return true;
}
else {
return false;
}
}
void Copy_List(List*node, List *list){
List * temp = node;
while(temp !=NULL){
int data = temp->item;
Insert_Element(&list, data);
temp = temp->nextNode;
}
cout<<"The copied list is:\n";
PrinList(list);
}
note:
Create constructor(default,parameterized and copy) and a manu of test the functions.
# Create displayList
displayList = []
# Loop through the prices in levelsList.
# During each loop:
# - Create a variable called priceLevelLabel consisting of the text 'Price Level: '
followed by the price.
# - Add priceLevelLabel and the price as two separate items to a new list (the sub-List).
# - Append the sub-List to displayList. for price in self.levelsList:
. . .
# Create a variable called previousPriceLabel consisting of the text 'Previous Price: ' followed
# by previousPrice. # Add previousPriceLabel and previousPrice as two separate items to a new list (the sub-List). # Append the sub-List to displayList.
. . .
# replace ellipsis with applicable cod
Why do we care that the expressions are equivalent? (5) 2.3.3 How can we determine that the expressions are equivalent?
Given the following declarations, what is the result of each of the assignments?
int w = 5, y = 9, z = 2;
a. z = w * y;
b. z += y;
c. y /= z;
d. y %= z;
e. y += y++;
f. y += --y;
Prepare a c++ program
board[4][3] = { {2,3,1},{15,25,13},{20,4,7},{11,18,14}};
Given the following declarations, what is the result of each of each output?
char a = 'a', b = 'B';
char c = ' ', d;
string s = "This is fun.";
int e;
System.out.println a. ("a = " + a); b.("a = " + 'a'); c.(a + b);
d. (s);
e. (s.length());
Prepare a c++ program of the two-dimensional array of the sample run below:
Sample Run:
[0] [1] [2] [3] [4] [5]
[0]
[1]
[2]
[3]
[4]
[5] 9.5
[6]
[7]
[8]
[9]
[10]
[11]