This code comes from a programming assignment that is no longer current from my class. I've already talked with the instructor, but it's still bothering me though that I couldn't get this version to work completely right. This one also has in my opinion an aesthetically better intended output then what I ended up with.
I've seemed to corner the issue down to a nested loop in the program.
I'm not sure how much of the code I should post, so I attached a copy of the c file.
Code:
NEWLINE;
printf("The characters for each line and their values: ");
NEWLINE;
count=num;
for(int i=0; i<num; i++){
pChar(cArray,i);
//printf("\nDebug: %d\n",i);
if(i%M==0&&0!=i){
NEWLINE;
for(int j=0;j<10; j++){
if(count==0){
break;
}
pValue(cArray, (i-(9-j))); // j is used as an offset from i
//printf("\nDebug: %d\n",(i-(9-j)));
notBool=1;
count--;
}
NEWLINE;
}}
if(notBool==0){
NEWLINE;
for(int k; k<10&&k<num; k++){
pValue(cArray,k);
}}