-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimplelist.c
91 lines (67 loc) · 1.14 KB
/
simplelist.c
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// node.cpp : Bu dosya 'main' işlevi içeriyor. Program yürütme orada başlayıp biter.
//
#include <iostream>
#include <cstdlib>
#define NULL 0
using namespace std;
struct nodeler
{
int x;
nodeler* next;
};
nodeler* kok=NULL;
void node_Add() {
if (kok == NULL) {
kok = new nodeler;
cout << "node ici degeri giriniz (bu ilk nodedir) : " << endl;
int b = 0;
cin >> b;
kok->x = b;
kok->next = NULL;
}
else {
int b = 0;
nodeler* iter = kok;
while (iter->next != NULL) {
iter = iter->next;
}
iter->next = new nodeler;
cout << "node ici degeri giriniz : " << endl;
cin >> b;
iter->next->x = b;
iter->next->next = NULL;
}
}
int i = 1;
void node_yazdir() {
while (kok != NULL) {
cout << i << ". Node'nin degeri : " << kok->x << endl;;
kok = kok->next;
i++;
}
}
void node_delete() {
nodeler* iter = kok;
if (kok->next == NULL) {
delete(kok);
kok = NULL;
}
else {
while (iter->next->next != NULL) {
iter = iter->next;
}
delete (iter->next);
iter->next = NULL;
}
}
int main()
{
int niyop = 3;
nodeler* kok=NULL;
while (niyop<7)
{
node_Add();
niyop++;
}
node_yazdir();
}