[aclug-L] Re: C programing problem
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Thanks for the help, but I figured it out on my own.
Heres the deal:
subtraction(int cntr1, int cntr2){
int numOne, numTwo, answer;
int again = 0;
char dummy = ' ';
while(again < 5){
numOne = numList1[cntr1];
numTwo = numList2[cntr2];
if((numOne - numTwo) > 0){
/* the addition module didn't have this type of loop, becuase i din't
have to worry about getting a negative answer.*/
printf("\nWhat is %d minus %d? ", numOne, numTwo);
scanf("\n%d", &answer);
if(answer == (numOne - numTwo)){
printf("\nYou are Correct, Sir!\n\n");
}else{
printf("\nhiii hooooo, you are WRONG!\n\n");
printf("the answer is %d\n", (numOne - numTwo));
}
/* By moving the incrementing of again to inside this loop, again is
only incremented when a problem is displayed; before again was
incremented every time through, even when the problem would produce a
negative answer and therefore not be displayed. */
again += 1;
}
cntr1 = cntr1 + 2;
cntr2 = cntr2 + 2;
if(cntr1 >= 9){
cntr1 = 2;
}
if(cntr2 >= 9){
cntr2 = 3;
}
}
printf("press any key");
scanf("\n%c", &dummy);
}
Once again, Thanks for help, and tips!
-James
-- This is the discussion@xxxxxxxxx list. To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
|
|