Answer:
The answer is "delete temp;".
Explanation:
- In the given code a class "doublyLinkedList" is defined that contains a method that is destroy(). This code uses a scope resolution operator to define the method outside the class.
- To access this method write return type of function then class name:: (use scope resolution operator) and function name.
- In this function, nodeType temp is a pointer variable that is used to delete the node.
- In method definition, a loop is declared that check value that is first not equal to nullptr. which means the first node is not equal to null. In this loop, a temp variable holds the first variable value and the first variable value is holding another variable value and then use the "delete temp" statement to delete a node in the list.
- Outside a loop, the last variable holds nullptr variable value and the count variable assigns a value that is 0.
The answer is ".NET" (had to increase character count to let me post).
<u> C++ Program to Print Pascal's Triangle</u>
#include<iostream>
//header file
using namespace std;
//driver function
int main()
{
int r;/*declaring r for Number of rows*/
cout << "Enter the number of rows : ";
cin >> r;
cout << endl;
for (int a = 0; a < r; a++)
{
int value = 1;
for (int b = 1; b < (r - a); b++)
/*Printing the indentation space*/
{
cout << " ";
}
for (int c = 0; c <= a; c++)
/*Finding value of binomial coefficient*/
{
cout << " " << value;
value = value * (a - c) / (c + 1);
}
cout << endl << endl;
}
cout << endl;
return 0;
}
<u>Output</u>
<u>Enter the number of rows : 5</u>
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1