#include "std_lib_facilities.h"
int main()
{
constexpr double euro_to_dollar = 1.11;
constexpr double yen_to_dollar = 0.0081;
double dollar = 1.00;
char unit= 'A';
cout <"Please enter a value followed by e or y: \n";
cin >>dollar>> unit;
if (unit= 'e')
cout << dollar << "Euro == " << euro_to_dollar*dollar << "dollar\n";
else if (unit='y')
cout << dollar << "Yen== " << yen_to_dollar * dollar << "dollar\n";
}
5 error: 'constexpr' was not declared in this scope 5 error: expected ';' before 'double' 7 error: expected ';' before 'double' 15 error: 'euro_to_dollar' was not declared in this scope 17 error: 'yen_to_dollar' was not declared in this scope
我做从编程的问题:原则和由Bjarne Stroustrup的练习使用C++(第二版)。我可以看到我在这里做错了什么。我试图学习C++,所以我基本上是一个初学者。我很感谢帮助的人。编译C++错误
您正在使用什么编译器?它支持C++ 11吗? –
'cout <“请输入一个值后跟e或y:\ n”;'应该是'cout <<' –