well, you could always fix num to see if you're loop works.
Then you'll know where the problem is.
The documentation says that dbInput takes 2 arguments. I've never used it though.
Quote: "Syntax
void dbInput ( char* szStatement, int iInput )
"
BTW, did you mean "without" here?
Quote: "for I tried running the program with the loop and it worked,"
One more thing. In general I don't use commands like atoi because I have had bad experiences with them. built in converters are usually built to crash the program if they receive an invalid input. Instead I make my own converter. I could explain how to do this, but it would kind of be a waste of my time if you don't care.
This isn't an issue though for your code since dbInput handles it.