I have to say Mr. Nebinger, you really are skeptic.
Like i said before, this is not homework. It can't possibly be homework
because i don't take any programming classes. I learn on my own. And, on
top of that, i never asked for any code, i merely asked for advice.
I found this problem on the internet, while i was looking for
application information for the University of Helsinki. Here's the link,
knock yourself out: http://www.joensuu.fi/tkt/teh_eng.htm
I'm happy to say that, given all of the advice i got, i was able to
solve the problem.
This is the important part of the code i wrote:
/* Where m > 1 */
for(i = (n-1); 1;)
{
/* Find the first nonzero array index */
for(j = 0; nsys[j] == 0 && j < (n-1); j++)
;
/* Print everything thereafter */
/* The first time around this will just print the last array index */
while(j < n)
printf("%d", nsys[j++]);
putchar('\n');
if(nsys[i] == (m-1))
{
/* Find the last array index less than (m-1) */
for(j = i; nsys[j] == (m-1) && j >= 0; j--)
;
/* If there is not one then we are all done */
if(j < 0)
break;
else
{
/* Increase it and set everything thereafter to zero */
/* Except the last array index (units) */
nsys[j]++;
j++;
while(j < i)
nsys[j++] = 0;
}
}
/* Increase the last array index (units) */
if(nsys[i] < (m-1))
nsys[i]++;
else
nsys[i] = 0;
/* Pause every ten iterations */
if(k++ == 9)
{
k = 0;
printf("\nPress any key to Continue or Ctrl-Break to Quit.\n");
getchar();
}
}
Thank you all very much for all your help. That includes you Mr.
Nebinger.
adios,
biterman.
<<That government is best which governs the least... that government is
best which governs not at all.>>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
|