尧图网站建设 尧图网络
  • 首页
  • 关于我们
  • 服务项目
  • 案例展示
  • 建站流程
  • 资讯中心
  • 联系我们
首页/资讯中心/详情

手搓文件管理系统(持续开发中)

手搓文件管理系统(持续开发中)
📅 发布时间:2026/6/20 16:08:30
#include<bits/stdc++.h>
using namespace std;/*** command:* 			cd [dirname]* 				to shift to a name_given dir* 			mkdir [dirname]* 				create a new dir under current dir* 			ls [dirname]* 				list the dir under current dir in specific order* * */int dircnt=1;       //the number of dir
int now=1;          //the dir's ID which you are now
int fa[100010];     //fa for Union-Find
map<string,int>mp;  //give it a name turned out a ID
struct direction{string dirname; //its nameint dep;        //the dep in the dir_treevector<int>son; //its son_dir
}a[100010];         //struct for directionsdeque<int>pos;      // your current path
int pos_size=1;     // the size of pathvoid mkdir(){//"mkdir"string new_name;cin>>new_name;if(mp[new_name]){//SPJ for [under]cout<<"already have this direction!"<<endl;return;}dircnt++;mp[new_name]=dircnt;           //IDfa[ dircnt ] = now;            //son and fathera[now].son.push_back(dircnt);  //contain IDa[dircnt].dep=a[now].dep+1;    //depa[dircnt].dirname=new_name;    //dir_namecout<<"Successfully make a dir named\""<<new_name<<"\""<<endl<<endl;
}int find_dep(int x,int to_dep){if(a[x].dep==to_dep)return x;return find_dep(fa[x],to_dep);
}void change_dir(){//"cd"string to_name;cin>>to_name;if(mp[to_name]==0){//SPJ for [under] invalid casecout<<"you don't have such a direction ,which named \""<<to_name<<"\""<<endl<<endl;return;}int to=mp[to_name],to_dep=a[to].dep;now=to;cout<<"Loading..."<<endl;pos.clear();//as you seepos_size=0;for(int i=1;i<=to_dep;i++){//start from Desktop (time_eff not good(no care))pos.push_back(find_dep(to,i));pos_size++;//dont forget pos_size//cout<<"id:"<<find_dep(to,i)<<"  and dir_name:"<<a[find_dep(to,i)].dirname<<endl;//test [up];}cout<<"Successfully changed to \""<<to_name<<"\""<<endl<<endl;
}void list_dir(int now){//"ls"}void init_system(){//as you seefor(int i=0;i<=100009;i++)fa[i]=i;    //Union-findmp["Desktop"]=1;        //desk_ida[1].dirname="Desktop"; //desk_namea[1].dep=1;             //desk_dep  now=1;                  //cur_pospos.push_back(1);       //cur_pathcout<<endl;             cout<<"<Desktop>:";
}void print_path(){cout<<"<";for(int i=1;i<=pos_size;i++){cout<<a[pos.front()].dirname;pos.push_back(pos.front());  pos.pop_front();if(i!=pos_size)cout<<" / ";  //SPJ//using a deque to turn it aside to output//your current path}cout<<">: ";
}int main(){init_system();while(1){string tmp;cin>>tmp;if(isdigit(tmp[0])){cout<<tmp<<endl;print_path();}if(!isdigit(tmp[0])){if(tmp=="mkdir"){mkdir();print_path();continue;}if(tmp=="cd"){change_dir();print_path();continue;}if(tmp=="ls"){list_dir(now);print_path();continue;}if(tmp=="shut"){cout<<endl<<"Shut down the system successfully!"<<endl;cout<<"Have a good day!"<<endl;exit(0);}print_path();}}return 0;
}
/*** g++ a.cxx* ./a.out* * **/

相关新闻

  • AGC001~030 合集
  • AGC 合集 1.0
  • 深入BERT内核:用数学解密掩码语言模型的工作原理

最新新闻

  • emWin内存设备优化:16位色深位图绘制函数定制指南
  • 3个神奇步骤:让Windows 11流畅运行经典老游戏的DDrawCompat解决方案
  • htmlwidgets最佳实践:代码组织、依赖管理与发布流程的完整指南
  • SharePoint Starter Kit v3 API集成指南:Microsoft Graph与外部系统对接
  • ARM7TDMI-S微控制器ISP/IAP编程与JTAG调试实战指南
  • 5个AI技能让你的Obsidian笔记效率提升300%

日新闻

  • 信任的进化:技术实现详解——如何用JavaScript构建博弈论模拟器
  • Terrakube自定义工作流:如何集成OPA、Infracost等工具扩展IaC能力
  • grunt-concurrent快速入门:5分钟学会并行运行Grunt任务

周新闻

  • 3步解锁iOS设备:applera1n激活锁绕过完全指南
  • 39 2026 人工智能证书终极盘点,普通人选 AI 证书可以从这些方向入手
  • Redis 暴露公网有多危险?从端口检查到补救步骤

月新闻

  • 【总结】入门篇:50句话让你记住架构核心概念
  • WeChatMsg技术方案解析:实现Mac微信数据自主管理的完整解决方案
  • WeChatMsg:革新性微信数据备份方案,打造你的专属数字记忆库

关于尧图

  • 公司简介
  • 团队介绍
  • 企业文化
  • 荣誉资质

服务项目

  • 定制开发
  • 电商建站
  • UI 设计
  • 运维服务

快速链接

  • 案例展示
  • 建站流程
  • 常见问题
  • 资讯中心

联系方式

  • 📍北京市朝阳区互联网产业园 A 座 10 层
  • 📞400-888-8888
  • ✉️contact@rkmt.cn
  • 🕐周一至周日 9:00-21:00

© 2024 北京尧图网络科技有限公司 版权所有 | 京 ICP 备 XXXXXXXX 号