tab自动补齐的c++实现

用过Linux系统的人哪怕是初学者,估计也会对TAB补齐有好感

现在要在windows平台下模拟一个Linux的文件系统,TAB补齐这么赞的功能怎能缺失

便自己写了一个玩玩:

代码在下面:

// tab.cpp: 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <stdio.h>
#include <string>
#include <conio.h>
#include <vector>
#include <string>
#include <iostream>
using namespace std;
vector <string> vc_of_str;
/*
ubuntu中的tab自动补全功能
在输入第一个操作数的时候是补全所有的指令
输入第二个操作数的时候是补全所有的当前目录下的东西
*/
int main() {
	string s1, s2;
	vc_of_str.push_back("cd");
	vc_of_str.push_back("mkdir");
	vc_of_str.push_back("ls");
	vc_of_str.push_back("vi");
	vc_of_str.push_back("sudo");
	vc_of_str.push_back("rm");
	vc_of_str.push_back("touch");
	vc_of_str.push_back("man");
	vc_of_str.push_back("cat");
	vc_of_str.push_back("clear");
	string s;
	int tabcount = 0;
	while (1) {
		int ch = _getch();
		if (ch == 8) {				//退格
		
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值