![]() |
| | #1 |
| Registered User Join Date: Aug 2009
Posts: 10
| C++ help Code: int main()
{ int num, factorial;
num = 6;
factorial = Fact(num);
cout << num << "! = "
<< factorial;
return 0;
} // end main
int Fact (int num)
{ if (num == 0)
return 1;
else
return num*Fact(num-1);
} //end Fact
|
| heredia21 is offline | |
| | #2 |
| and the hat of sweating Join Date: Aug 2007 Location: Toronto, ON
Posts: 3,425
| Put the main() function at the bottom. You also forgot to: Code: #include <iostream> using namespace std;
__________________ "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008 "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010 |
| cpjust is offline | |
| | #3 |
| Registered User Join Date: Aug 2009
Posts: 10
| Code: #include <iostream>
using namespace std;
int num, factorial;
num = 6;
factorial = Fact(num);
cout << num << "! = "
<< factorial;
return 0;
} // end main
int Fact (int num)
{ if (num == 0)
return 1;
else
return num*Fact(num-1);
} //end Fact
int main()
|
| heredia21 is offline | |
| | #4 |
| Registered User Join Date: Dec 2009 Location: Henderson, NV
Posts: 887
| Not even close: Code: #include <iostream>
using namespace std;
int Fact (int num)
{ if (num == 0)
return 1;
else
return num*Fact(num-1);
} //end Fact
int main()
{ int num, factorial;
num = 6;
factorial = Fact(num);
cout << num << "! = "
<< factorial;
return 0;
} // end main
|
| jeffcobb is offline | |
| | #5 |
| Registered User Join Date: Aug 2009
Posts: 10
| thanks alot |
| heredia21 is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|