?? myio.cpp
字號:
#include "myIO.h"
#define MAX 80
char buffer[MAX];
myIO::myIO()
{
passcode = '*';
prein = " Lelouch >> ";
preout = " Lelouch << ";
}
myIO::~myIO()
{
}
String myIO::getIn(int type)
{
String str;
char ch;
int i;
// std::cout << std::endl;
while (true)
{
std::cout << prein;
if (type == 1)
{
i = 0;
while ((ch = getch()) != '\r')
{
if (ch == '\b')
{
if (i > 0)
{
buffer[i--] = '\0';
std::cout << '\b' << ' ' << '\b';
}
}
else
{
buffer[i++] = ch;
std::cout << passcode;
}
}
buffer[i] = '\0';
str = buffer;
std::cout << std::endl;
}
else
std::cin >> str;
if (str.getlenth() != 0)
{
if (str.getlenth() == 1)
return str;
String temp = str.getSub(str.getlenth() - 2, str.getlenth());
if (temp == "\\c")
str = '\0';
else if (temp == "\\h")
{
Help();
str = '\0';
}
else
return str;
}
}
}
void myIO::putOut(String str)
{
str.reGetlenth();
std::cout << preout;
std::cout << str;
std::cout << std::endl;
}
void myIO::SetPreIn(String aPre)
{
prein = aPre;
}
void myIO::SetPreOut(String aPre)
{
preout = aPre;
}
void myIO::SetCode(char ch)
{
passcode = ch;
}
myIO& operator>>(myIO& io, String& str)
{
str = io.getIn(0);
return io;
}
myIO& operator<<(myIO& io, const String& str)
{
io.putOut(str);
return io;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -