|
#include "..\LiteralConversion\LiteralConverter.h"
#include <iostream>
int main()
{
using namespace std;
// 1. declare an object
CLiteralConverter lc;
string s = "FA1E1FAC, FA1E1FAD";
// 2. assign the input string, using the default delimiters(",; :h")
lc.SetString(s, CLiteralConverter::HEX);
// 3. get the converted string, using the default delimiters("; ")
cout << "Convert to DEC string:\n"
<< "[" << s <<"] = [" << lc.GetString(CLiteralConverter::DEC) << "]\n";
cout << "Convert to OCT string:\n"
<< "[" << s <<"] = [" << lc.GetString(CLiteralConverter::OCT) << "]\n";
cout << "Convert to HEX string:\n"
<< "[" << s <<"] = [" << lc.GetString(CLiteralConverter::HEX) << "]\n";
cout << "Convert to BIN string:\n"
<< "[" << s <<"] = [" << lc.GetString(CLiteralConverter::BIN) << "]\n";
// or: get the value for customizeed treatment
vector<size_t> vl;
lc.GetValue(vl);
cout << "Convert to values:\n"
<< "[" << s <<"] = [" << vl.front() << ", " << vl.back() << "]\n";
system("pause");
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.