mirror of
https://github.com/szymon-jozef/ZUT-notatki.git
synced 2026-09-07 20:20:39 +02:00
update
This commit is contained in:
17
uczelnia/1_semestr/programowanie/structy.cpp
Normal file
17
uczelnia/1_semestr/programowanie/structy.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#import <iostream>
|
||||
|
||||
struct One_way_list {
|
||||
int value;
|
||||
One_way_list *next;
|
||||
One_way_list(int val, One_way_list *nxt) : value(val), next(nxt) {}
|
||||
};
|
||||
|
||||
int main() {
|
||||
One_way_list *node3 = new One_way_list(30, nullptr);
|
||||
One_way_list *node2 = new One_way_list(20, node3);
|
||||
One_way_list *node1 = new One_way_list(10, node2);
|
||||
|
||||
for (One_way_list *i = node1; i != nullptr; i = i->next) {
|
||||
std::cout << i->value << std::endl;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user