我想将像“Celcius”这样的字符串传递给我拥有的函数,但我不断收到来自函数的错误。
System::Console::WriteLine' : none of the 19 overloads could convert all the argument types
我想我只是有一些简单的错误。有人可以指出我的错误吗?使用 MS Visual C++ 2010
我已经发布了有问题的代码。其他功能(未发布)工作正常。
void PrintResult( double result, std::string sType ); // Print result and string
// to the console
//=============================================================================================
// start of main
//=============================================================================================
void main( void )
{
ConsoleKeyInfo CFM;
// Program Title and Description
ProgramDescription();
// Menu Selection and calls to data retrieval/calculation/result Print
CFM=ChooseFromMenu();
switch(CFM.KeyChar) // ************************************************************
{ //*
case '1' : PrintResult(F2C(GetTemperature()),"Celsius"); //*
break; //*
//*
case '2' : PrintResult(C2F(GetTemperature()),"Fahrenheit"); //*
break; //*
//*
default : Console::Write("\n\nSwitch : Case !!!FAILURE!!!"); //*
} //************************************************************
system("pause");
return;
}
//Function
void PrintResult( double result, std::string sType )
{
Console::WriteLine("\n\nThe converted temperature is {0:F2} degrees {1}\n\n",result,sType);
return;
}