Go Back   iTrader Forums » iTrader Chat » General Chit Chat » Programming PHP | PERL | ASP| ColdFusion| C++

Programming PHP | PERL | ASP| ColdFusion| C++ Chat with other forum members about programming.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 14th November 2007, 09:10 AM
Junior Member
 
Join Date: Nov 2007
Posts: 1
Credits: 0
Default why this c program is going infinite!!!!!!?

Program is to find no. of days between 2 dates.Logic is to add 1 day to 1 date till it reaches other.#include#includevoid main(){int a,b,c,d,e,f,flag=0;printf("Enter first date");scanf("%d%d%d",&a,&b,&c);printf("Enter second date");scanf("%d%d%d",&d,&e,&f);while(c!=f||b!=e|| a!=d) //If I comment c!=f this program works otherwise it goes infinite!{a++;if((b==4)||(b==6)||(b==9)||(b==11))f =30;else if(b==2){if(d%4==0)f=29;elsef=28;}elsef=31;if(a>f) {b++;a=1;}if(b==13){c++;b=1;}flag++;}printf("%d",f lag);getch();}
Reply With Quote
  #2 (permalink)  
Old 14th November 2007, 01:14 PM
Junior Member
 
Join Date: Nov 2007
Posts: 1
Credits: 0
Default

i did this program its to find persons age& hw many days he lived its very simplefirst u substracted the old year from recent yearthan answer*365other line subtract large month to smaller 1 than answer*30than just add the days ok that was mine i wont do ur prob i might get answer 2moro when i go to my class
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:09 AM. Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
Ad Management by RedTyger


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72