Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Bad code
//Title of this code #include <iostream> using namespace std; struct Node { Node *next; int e; Node(Node *p, int n): next(p), e(n) {} }; void rev(Node *first, int k) { Node *cur, *tmp, *tmp2, *tmp3; cur = first; while (cur != NULL) { int i = k; tmp = cur; while (i > 0) { tmp2 = cur; cur = cur->next; if (!cur) break; --i; tmp3 = cur; cur->next = tmp2; cur = tmp3; } if (i == 0) { } } } void print(Node *first) { while (first != NULL) { cout << first->e << " "; first = first->next; } cout << endl; } int main() { //Node *first = new Node(new Node(new Node(new Node(new Node(new Node(new Node(NULL, 7), 6), 5), 4), 3), 2), 1); Node *first = new Node(new Node(new Node(NULL, 3), 2), 1); //rev(first, 3); print(first); cout << "Hello, world!\n"; }
run
|
edit
|
history
|
help
0
20201123
Dar
Pairs with given sum
OTHER - Two robots
Średnia bez zera
ExceptExpo
MyStack
Stock buy/sell, maximum subarray problem
顺序表的实现——动态分配
Hello world!