Rercusive Program problem -Returning 0 only and not seeing the steps

THe program is supposed to give the recsive answer and the loop answer. The recusive anwer is always giving 0 - as its answer.and that is inccorrect It is supposed to show the steps and so is the loop answer. Can someone plase help me

#include<iostream>

using namespace std;

float wk7recur (float fnum, int inum);
float wk7loop (float fnum, int inum);

int main()
{

float recurive_answer,loop_answer, num;
int num1;


cout<<endl;
cout<<" This program calculates the recusive and interation " << endl;
cout<<" version of the problem and displays the answers "<<endl;

do
{

recurive_answer = wk7recur( num, num1);
loop_answer = wk7loop ( num, num1);

cout <<endl <<endl;
cout << " Please enter two numbers ";

cin >> num >> num1;
cout <<" " << recurive_answer <<" " << loop_answer;
}while (num !=0);



cout<<endl<<endl;
cout << "Press [enter] to exit" <<endl;
cin.ignore(); //needed because of keyboard input
cin.get();
return 0;
}
float wk7recur (float fnum, int inum)
{

if (inum == 0)
return 1;
else
return (fnum * wk7recur(fnum,inum -1));

}
float wk7loop (float fnum, int inum)
{
for (fnum = 1; fnum <= inum; fnum++)

fnum = inum;
return fnum;
}
You have to read in num and num1 before you call the functions with num and num1 as
parameters.
Topic archived. No new replies allowed.