Understanding The Question Is A Part of Exam So No Queries
Understanding The Question Is A Part of Exam So No Queries
Single linked list class and some function definitions already given , you have to
implement following functions and write the main accordingly:
#1 void square_all_node( )
#2 int Max_value_node_no( )
Return the node# having maximum value
example 2->3->4->5->7->0
Return 5 as maximum value(7) found at node # 5
#3 in main
Code to be completed:
#include "stdafx.h"
#include<iostream>
using namespace std;
class List
{
private:
struct node
{int data;
node *next;
} *head;
public:
List(){head=NULL;}
~List(){}
bool emptyList(){}
void square_all_node( )
{
node *temp1, *temp2;
int Max_value_node_no( )
{
node *ptr1,*ptr2;
}
void traverse()
{
node *ptr;
ptr=head;
while(ptr!=NULL)
{
cout<<ptr->data<<endl;
ptr=ptr->next;
}
}
};
List L1;
system("pause");
return 0;
}