+ 3

Can anyone help me find a way to achieve the same result with loops without having to call function over function

#include <iostream> #include <cmath> using namespace std; const double c=2015; double b,z,y,b1,b2,b3,b4; double s_b(double x); int main() { cout<<"enter the value of your birth"<<endl; cin>>y; /*this should trigger four birth month calculations the previous becomes the new input of the other function that is how they are linked */ b1=s_b(y); b2=s_b(b1); b3=s_b(b2); b4=s_b(b3); } double s_b(double x) { z=sqrt(c*(x-1)); cout<<z<<endl; return z;}

30th Jan 2018, 3:56 PM
Revolution
Revolution - avatar
5 Answers
+ 3
Personally, looks like you got most of it done so the little bit I did is nothing. https://code.sololearn.com/cct9VjKxDyK7
30th Jan 2018, 4:47 PM
John Wells
John Wells - avatar
+ 4
thank you for your help really appreciate it #John Wells
30th Jan 2018, 5:03 PM
Revolution
Revolution - avatar
+ 3
As you can see, it was easier than you thought.
30th Jan 2018, 5:06 PM
John Wells
John Wells - avatar
+ 3
I will bare that in mind, and I do get your point #Low Kai Han. this code was my product.
30th Jan 2018, 5:30 PM
Revolution
Revolution - avatar
+ 2
There are cases where people post their assignment or practical questions directly and ask for answers without understanding the meaning of the codes. If this code is your own product, kindly specify this to avoid offensive thoughts. If this code is a task assigned to you by your school, kindly make your own try and post your code here. We shouldn't provide direct answer to you, but we can help you correct errors and improve your code.
30th Jan 2018, 4:38 PM
Hanz
Hanz - avatar