本文整理汇总了C++中Convert::GetUnitAbbr方法的典型用法代码示例。如果您正苦于以下问题:C++ Convert::GetUnitAbbr方法的具体用法?C++ Convert::GetUnitAbbr怎么用?C++ Convert::GetUnitAbbr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Convert
的用法示例。
在下文中一共展示了Convert::GetUnitAbbr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowConvertingInfo
void ParserManager::ShowConvertingInfo()
{
HWND conv_tab = GetPrgRes()->GetTabWindow(TabWindowFunctions::tab_convert);
if( conv_type==0 || conv_input_unit==-1 || conv_output_unit==-1 ||
conv_input_unit == conv_output_unit )
{
SetDlgItemText(conv_tab, IDC_EDIT_OUTPUT_INFO, "");
return;
}
Convert * pconv = GetPrgRes()->GetConvert();
// the first unit to the second
ttmath::Big<1,1> result;
result.SetOne();
std::string buffer1 = "1 ";
buffer1 += pconv->GetUnitAbbr(country, conv_input_unit);
buffer1 += " = ";
if( pconv->Conversion(conv_input_unit, conv_output_unit, result) )
{
SetDlgItemText(conv_tab, IDC_EDIT_OUTPUT_INFO, "overflow" );
return;
}
result.ToString(buffer2, 10, false, 3, -1, true);
buffer1 += buffer2;
buffer1 += " ";
buffer1 += pconv->GetUnitAbbr(country, conv_output_unit);
// the second unit to the first
buffer1 += " 1 ";
buffer1 += pconv->GetUnitAbbr(country, conv_output_unit);
buffer1 += " = ";
result.SetOne();
if( pconv->Conversion(conv_output_unit, conv_input_unit, result) )
{
SetDlgItemText(conv_tab, IDC_EDIT_OUTPUT_INFO, "overflow" );
return;
}
result.ToString(buffer2, 10, false, 3, -1, true);
buffer1 += buffer2;
buffer1 += " ";
buffer1 += pconv->GetUnitAbbr(country, conv_input_unit);
SetDlgItemText(conv_tab, IDC_EDIT_OUTPUT_INFO, buffer1.c_str() );
}