C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C++

I tried to run the code but am receiving an error of " no matching function call"im not sure why this is the case. The problem should be in the main . However, I think u have used correct procedure for calling function https://code.sololearn.com/cpQQQ1crtMBZ/?ref=app

4th Dec 2020, 12:18 AM
Reynolds Onyango
Reynolds Onyango - avatar
6 Answers
+ 2
Now I understand you want to return the sine and cosine through the function arguments. It explains why you had void set as function return type. The problem is: 1. You should've passed <x> and <n> by value because they are not changed in the `calculate_trig_from_series` function. You need to pass <sin_val> and <cos_val> by reference in order to have their updated value reflected in main function. 2. You shouldn't chain the call to `calculate_trig_from_series` function with the data to be inserted into output stream. The function doesn't return anything so there is nothing to be inserted to the output stream. You call the `calculate_trig_from_series` function in a separate line. https://code.sololearn.com/c7I5D1BBdEjz/?ref=app
4th Dec 2020, 1:23 AM
Ipang
+ 1
void calculate_trig_from_series This function doesn't return any valid data to be inserted into the output stream `cout`.
4th Dec 2020, 12:26 AM
Ipang
+ 1
Super bro. Your help has been invaluable. I can see my mistakes now. And the program works like a charm. God Bless🙏🏾
4th Dec 2020, 7:56 AM
Reynolds Onyango
Reynolds Onyango - avatar
0
I have changed the type to double but still some problem
4th Dec 2020, 12:31 AM
Reynolds Onyango
Reynolds Onyango - avatar
0
What is it exactly are you trying to do? Now the function name is gone, only the return type is left. And you have 2 return statements at line 27.
4th Dec 2020, 12:34 AM
Ipang
0
I'm trying to calculate the sine and cosine value using the formulas in the function and be able to pass parameters in main
4th Dec 2020, 12:41 AM
Reynolds Onyango
Reynolds Onyango - avatar