| ??? 01/01/05 18:20 Read: times |
#84204 - *unnecessarily* complex! Responding to: ???'s previous message |
int IsLeapYear( int y )
{
if( ((y % 4) == 0) && ((y % 100) != 0) || ((y % 400) == 0) )
return( 1 );
else
return( 0 );
}Shahzad said:
i am really having bad experience when it comes to complex maths programming on 8052. as can be seen its only operations like y % 400 in the function which is creating problems How do you deduce that it is the (y % 400) that is the problem? One obvious problem here is that the expression is unnecessarily complex. You need to break it down into simpler steps - then it will be easier to understand and easier to debug!! |
| Topic | Author | Date |
| Keil C Code not working | 01/01/70 00:00 | |
| Desktop turbo c++ ? | 01/01/70 00:00 | |
| Slightly??!! | 01/01/70 00:00 | |
| agreed | 01/01/70 00:00 | |
| i got the math to do div / multiply | 01/01/70 00:00 | |
| Debugger? Simulator? Maths? | 01/01/70 00:00 | |
| Question... | 01/01/70 00:00 | |
| Please use Correct Terms | 01/01/70 00:00 | |
| Re Andy Debugger, Simulator? Math | 01/01/70 00:00 | |
| *unnecessarily* complex! | 01/01/70 00:00 | |
| Re andy | 01/01/70 00:00 | |
| Divide and Conquer! | 01/01/70 00:00 | |
| Bad Burner? | 01/01/70 00:00 | |
| Re Andy Bad Burner | 01/01/70 00:00 | |
| Project Configuration? | 01/01/70 00:00 | |
| debugging? | 01/01/70 00:00 | |
| thanks for the link | 01/01/70 00:00 | |
| Data Sizes - Lesson not yet learned? | 01/01/70 00:00 | |
| Re Andy | 01/01/70 00:00 | |
| brackets ? | 01/01/70 00:00 | |
| (no) brackets | 01/01/70 00:00 | |
| WriteCommandLCD ? | 01/01/70 00:00 | |
| Re Andy | 01/01/70 00:00 | |
| Problem not fixed yet? | 01/01/70 00:00 | |
Problem not fixed yet? | 01/01/70 00:00 |



