Tuesday, 17 December 2013

C++ Calculate Total days in Year by Input only February days in current year or else year

#include<iostream.h>
#include<conio.h>

void main()
{
int months[11]={31,31,30,31,30,31,31,30,31,30,31};
int fab;
cout<<"How much Days in Fab this year = "; cin>>fab;
int i=0;
int *ptr;
while(i<=11)
{
 fab=fab+months[i];
 ptr=&fab;
 i++;
}
cout<<"total Days this Year Will be = "<<fab;
getch();
}

output :-