-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.h
More file actions
53 lines (42 loc) · 702 Bytes
/
node.h
File metadata and controls
53 lines (42 loc) · 702 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
/**
CS 8 Fall 2014 test 1
node.h
function: linked list
source: Previous CS 8 class with modifications
*/
#ifndef NODE_H
#define NODE_H
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <string>
using namespace std;
template<typename T>
struct node
{
T data;
node* next;
node();
node(const T &d);
template<typename U>
friend
ostream operator<< (ostream& out, node<U> t);
};
template<typename T>
node<T>::node()
{
next = NULL;
}
template<typename T>
node<T>::node(const T &d)
{
data = d;
next = NULL;
}
template<typename U>
ostream& operator<<(ostream& out, node<U> t)
{
out<<t.data<<" ";
return out;
}
#endif // NODE_H