#include "iostream"
#include "string"
using namespace std; typedef struct node{
string data;
struct node *next;
node(string str){
data=str;
next=NULL;
} }Node; Node *head=new node("hfirst");
Node *back=new node("bfirst");
Node *current=NULL;
Node *pre=head; void add(string str){
Node *temp;
if(back->data=="bfirst")
temp=new Node(str);
else{
temp=back->next;
back->next=temp->next;
temp->data=str;
temp->next=NULL;
}
temp->next=head->next;
head->next=temp;
current=temp;
} void move(int p){
int i=;
for(;i<p;i++){
pre=current;
if(current==NULL){
cout<<"worng!!!"<<endl;
current=head->next;
pre=head;
break;
}
else
current=current->next;
} } void del(int i){
Node *temp=current;
Node*tp;
while(i!=&&current!=NULL){
tp=current;
current=current->next;
i--;
}
if(current==NULL){ back->next=pre->next;
pre->next=NULL;
pre=head;
current=head->next;
}
else{
pre->next=current;
tp->next=NULL;
temp->next=back->next;
back->next=temp;
} }
void _print(){
cout<<current->data;
} void main(){
string choice,str;
int i;
while(){
cin>>choice;
if (choice==("ADD")){cin>>str;add(str);}
if (choice==("MOVE")){cin>>i;move(i);}
if (choice==("DEL")){cin>>i;del(i);}
if (choice==("PRINT"))_print();
}
getchar();
}

最新文章

  1. SPOJ : DIVCNT2 - Counting Divisors (square)
  2. Flume+kafka+storm+hdfs
  3. matlab产生正态分布样本
  4. leetcode@ [84/85] Largest Rectangle in Histogram &amp; Maximal Rectangle
  5. 百度编辑器umeditor使用总结
  6. jQuery下的显示和隐藏
  7. C4.5较ID3的改进
  8. 转 c#代码访问https服务器以及https的webservice
  9. go-设计思想
  10. 自定义mysql类用于快速执行数据库查询以及将查询结果转为json文件
  11. NOIP 普及组 2013 表达式求值
  12. jquery easyui:tab自动加载第一个tab内容
  13. mobile开发备忘
  14. [转]TensorFlow---岂止深度学习
  15. SpringBoot------注解把配置文件自动映射到属性和实体类
  16. Jacoco的原理(各个覆盖率的解释)
  17. shortcut&amp;website
  18. python pip 安装OpenCV
  19. Apache 中httpd.conf文件配置详解(转载)
  20. 如何为运行的 ARM Linux 启用 LAD2.3 版本的诊断扩展

热门文章

  1. TOMCAT源码分析(启动框架)
  2. Qt持久性对象进行序列化
  3. MVC在VIEW中动态控制htmlAttributes和routevalues的方法
  4. Hubilder用git插件安装使用
  5. JS-007-富文本域操作
  6. asp.net MVC中如何用Membership类和自定义的数据库进行登录验证
  7. thinkPHP 接支付宝及时到账接口
  8. empty()函数经典详解
  9. 微信连Wi-Fi专业设备列表
  10. gdb 7.11