i have an assignment to complete and i'm stuck on some of the code. i've talked to collegues. they say nothings wrong with the logic, just the syntax, but they can't fix it. can anyone help?!
i have an assignment to complete and i'm stuck on some of the code. i've talked to collegues. they say nothings wrong with the logic, just the syntax, but they can't fix it. can anyone help?!
HaHa -- blind leading the blind.i've talked to collegues. they say nothings wrong with the logic
needs a few more braces -- and better coding style. Use == instead of = when boolean operator is intended.Code:if (correctans=answer) printf("Correct."); counter1++; else {
Code:if (correctans == answer) { printf("Correct."); counter1++; } else { if(correctans != answer) { printf("That is not correct, please try again."); printf("\n\t\t\tWhat is %d times %d?: ",num,counter); scanf("%d",&answer); correctans=num*counter; }
Last edited by Ancient Dragon; 01-16-2006 at 09:37 AM.
>>main()
Main returns an int
>>printf("\t\tYou have selected the %d times able.",num);
Being picky I know, but typo, should be table
>>if (correctans=answer)
That should be == when testing for equality; same problem on line 53
Your indentation is a bit all over the place which'll make it harder to follow; as far as I can see there's nothing wrong with the logic (I just scanned through the syntax, however).
EDIT: Damn you AD!
Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.
- Mike McShaffry
That looks like C code not C++