strtype.cpp
来自「此文件可以能帮你求体积」· C++ 代码 · 共 65 行
CPP
65 行
// StrType.cpp: implementation of the StrType class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "StrType.h"
#include <string.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
StrType::StrType()
{
*s = '\0';
}
StrType::StrType( char* p)
{
strcpy( s, p );
}
StrType::~StrType()
{
}
StrType StrType::operator+( StrType& s2 )
{
StrType t;
strcpy( t.s, s );
strcat( t.s, s2.s );
return t;
}
StrType& StrType::operator =( StrType& s2 )
{
strcpy( s, s2.s );
return *this;
}
int StrType::operator <( StrType& s2 )
{
return strcmp( s, s2.s ) < 0;
}
int StrType::operator >( StrType& s2 )
{
return strcmp( s, s2.s ) > 0;
}
int StrType::operator ==( StrType& s2 )
{
return strcmp( s, s2.s ) == 0;
}
char* StrType::Get()
{
return s;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?