📄 e1_link.cpp
字号:
// HELLO.cpp : Defines the entry point for the console application.
//
#include "stdio.h"
#include "malloc.h"
#include "stdlib.h"
#include "LinkList.h"
Status LinkInverse(LinkList &L){
LinkList p;
p=L->next; //record the first node
L->next=NULL;
while(p){ //from the first node to the end node
ListInsert_L(L, 1, p->data); // insert always before the first node
p=p->next;
}
return OK;
}
int main(int argc, char* argv[])
{
LinkList L1, p;
int x,i;
InitList_L(L1);
printf("please enter 10 integers:\n");
for(i=1;i<=10;i++) { //输入表的内容
scanf("%d",&x);
ListInsert_L(L1,i,x);
}
p=L1->next;
while(p){
printf("%d,", p->data);
p=p->next;
}
LinkInverse(L1);
printf("\n逆置后表中的10个整数为:");
p=L1->next;
while(p) { // output the inverse result
printf("%d,",p->data);
p=p->next;
}
getchar();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -