Compile C++ error -
#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 value followed 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' not declared in scope 5 error: expected ';' before 'double' 7 error: expected ';' before 'double' 15 error: 'euro_to_dollar' not declared in scope 17 error: 'yen_to_dollar' not declared in scope
i'm doing problem programming: principles , practice using c++ (2nd edition)by bjarne stroustrup. , can see i'm doing wrong here. trying learn c++, beginner. appreciate guys.
i don't know there in local header file
#include "std_lib_facilities.h"
in place of added following lines of code
#include<iostream> using namespace std;
if (unit = 'e')
//doing assignment should correct follows
if (unit == 'e'), //checking equal or not
else if (unit ='y')
should correct follows because of same reason
else if (unit =='y')
moreover should compile using compiler option -std=c++11
Comments
Post a Comment