-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjay6.cpp
More file actions
60 lines (52 loc) · 843 Bytes
/
jay6.cpp
File metadata and controls
60 lines (52 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include<iostream>
using namespace std;
class node{
public:
float data;
node* next;
node(float val){
data=val;
next=NULL;
}
};
node* insertAtHead(node* head,float x) {
node n(x);
n.next=head;
return &n;
}
node* insertAtTail(node* head,float x) {
node n=new node(x);
node* temp=head;
if(head==NULL){
//head=&n;
return &n;
}
while(temp->next){
temp=temp->next;
}
}
node*
void Search(node* head,int x){
if(head==NULL){
return ;
}
node* temp=head;
while(temp){
if(temp->data==x){
cout<<"Yeas\n";
return ;
}
else{
temp=temp->next;
}
}
cout<<"No"<<endl;
return ;
}
int main(){
node n1(5);
node n2(56);
n1.next= &n2;
cout<<n1.data<<endl;
return 0;
}