Hereis my last problem for the week. I talked to the prof on email and still dont understand what he wants. I am going to post my problem and could someone explain to me what this actually means, I am really lost.

Code:

Write a C++ Program to calculate the following function:
PowerInt(n) = (n!)/n(2) , if n<=1 and n<=10
Power Int (0) = 1
PowerInt (n) = error, if n<0 or n>10
Where n! = 1*2*3...*n for n>=1.

I was bored. Yeah yeah, I know recursion takes up lots of memory and yada, yada, yada. I use the recursive solution to finding factorials because I can remember it off the top of my head. For your class you probably ought to go with an iterative factorial function instead.

07-09-2003

Speedy5

Well the question itself from the teacher has a problem. The first part clearly shows multiplication, the examples show sqauring... lol

Or maybe n is a function... Or maybe some really wierd notation... It should be n^2...

Write a C++ Program to calculate the following function:
PowerInt(n) = (n!)/n(2) , if n<=1 and n<=10
Power Int (0) = 1
PowerInt (n) = error, if n<0 or n>10
Where n! = 1*2*3...*n for n>=1.

I was reading over all these codes given on here and checking in my textbook and I dont understanf what y; does and float z;, I'm really lost, could you maybe explain that a little more into detail. I have never even seen this until now and I dont know where to start let alone what that code means that you wrote to help me out. sorry about that.

07-10-2003

quzah

Quote:

Originally posted by romeoz I was reading over all these codes given on here and checking in my textbook and I dont understanf what y; does and float z;, I'm really lost, could you maybe explain that a little more into detail. I have never even seen this until now and I dont know where to start let alone what that code means that you wrote to help me out. sorry about that.