I am starting to learning C++ and am trying some simple examples. However the example below gives me the following error:
main.cpp:20:32: error: ‘_cal_order’ was not declared in this scope
double pos=_cal_order(p,n,l);
I am just trying to pass 3 variables to a function and return a double result. Here is the code:
#include<math.h>
#include <iostream>
using namespace std;
int main()
{
int n = 5000;
double p = 45000.0;
double l = 0.001;
double pos=_cal_order(p,n,l);
cout<<pos<<endl;
};
double _cal_order(double p, int n, double l)
{
return static_cast<double>(round(n/(p*l)))*l;
};