init: gtest and quiz 1.
This commit is contained in:
30
mixplus/include/parser.h
Normal file
30
mixplus/include/parser.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
struct Result
|
||||
{
|
||||
std::string hexadecimal;
|
||||
|
||||
long digit;
|
||||
};
|
||||
|
||||
namespace mixplus
|
||||
{
|
||||
struct Parser
|
||||
{
|
||||
// 识别两个字符串并相加
|
||||
static long parseAndAdd(int argc, const char** argv);
|
||||
|
||||
// 格式化输出
|
||||
static Result formatResult(long value);
|
||||
|
||||
// 识别十进制或者十六进制输出
|
||||
static long parseNumber(const std::string& input);
|
||||
|
||||
// 识别十进制
|
||||
static long parseDigit(const std::string& input);
|
||||
|
||||
// 识别十六进制且已去掉0x头部
|
||||
static long parseHexadecimal(const std::string& input);
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user