1. ## factor program

I need some help with this program, it is homework but I can't figure it out. This is what I have to do:

Modify the FACTOR program in this chapter so that it repeatedly asks for a number and calculates its factorial, until
the user enters 0, at which point it terminates. You can enclose the relevent statements in FACTOR in a while loop or a
do loop to achieve this effect.

Here is what I have thus far:
Code:
```#include <iostream>
using namespace std;

int main()
{
unsigned int numb;
unsigned long fact=1;	//long for larger numbers

cout << "Enter a number: ";
cin >> numb;	//get number
for(int j=numb; j>0; j--)	//multiply 1 by
fact *= j;				//numb, numb-1, ..., 2, 1
cout << "Factorial is " << fact << endl;
int dummy;
cin >> dummy;
return 0;
}```

2. That just looks like the unmodified factorial program that's in the book... You're supposed to wrap it in a loop that breaks when the user enters '0'. Did you learn about loops, yet?

...and get those "dummy" statements out of there and just replace it with a
Code:
```cin.ignore();
cin.get();```

3. yeah I'm just learning loops. It is from what is in the book but I can't figure out how to change it to what it is asking for. Can you give me a hint or something?

4. I gave you a hint... use a loop.

Here is a few more...

...and if you're still expecting code, then perhaps you should read the Homework Policy.

All you need is a loop. It's literally two lines of code and one of them is a closing brace. If you want to work around your factorial calculation and output on zero then it's 3-4 lines of code tops. Which means, sans studying loops (which by the way... you WILL be using if you plan on continuing programming past this assignment) this is at a maximum a 60 second assignment. So read your book, learn loops, and just do it.

5. Originally Posted by SlyMaelstrom
That just looks like the unmodified factorial program that's in the book... You're supposed to wrap it in a loop that breaks when the user enters '0'. Did you learn about loops, yet?

...and get those "dummy" statements out of there and just replace it with a
Code:
```cin.ignore();
cin.get();```
Why don't you like << and >> operators?

6. Why don't you like << and >> operators?
Formatted input in not necessary here, and cin.ignore()/cin.get() is somewhat more canonical.