📄 turningmachine.cpp
字号:
// TurningMachine.cpp: implementation of the TurningMachine class.
//============================================
//作者:刘涛
//单位:西安交通大学
//电子邮件:service@longen.com
//http://www.longen.com
//============================================
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Turning.h"
#include "TurningMachine.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
TurningMachine::TurningMachine()
{
LeftString = RightString = "";
Status = Left;
}
TurningMachine::~TurningMachine()
{
}
void TurningMachine::ChangeStatus()
{
if (LeftString.IsEmpty()) return; //if empty, do nothing;
int last = LeftString.GetLength()-1;
//pls read readme.txt to learn what the following if...then pairs do
if (LeftString[last]=='0')
{
if (Status==Left) RightString += '0', Status = Left;
else //Status==Right
RightString += '1', Status = Left;
}
else //LeftString[last]=='1'
{
if (Status==Left) RightString += '1', Status = Right;
else //Status==Right
RightString += '1', Status = Right;
}
LeftString = LeftString.Left(last);
}
CString TurningMachine::GetLeftString()
{
return LeftString;
}
CString TurningMachine::GetRightString()
{
return RightString;
}
int TurningMachine::GetStatus()
{
return Status;
}
void TurningMachine::Init(CString String, int status)
{
LeftString = String;
RightString.Empty();
Status = Status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -