Selasa, 02 Oktober 2012

script kalender c++



#include <iostream>using namespace std;#include<iomanip.h>#include<stdlib.h>void main(){int year;int a,c;int b=0;int d=1;int date = 1;int month = 1;int i=0;cout<<"Enter the year :";cin>>year;c = year%4;if(c==0)cout<<"It is a leap year!";else cout<<"It is not a leap year!";cout<<endl<<endl<<endl<<endl<<"Enter the day of 1st january -->"<<endl<<"1 for monday\t"<<"2 for tuesday\t"<<"3 for wednesday\t"<<"4 for thursday\t"<<"5 for friday\t"<<"6 for saturday\t"<<"7 for sunday\t:"<<endl;cin>>a;do{if(a<=0  a>7){cout<<"Invalid.... Try again!!";cin>>a;}}while(a<=0  a>=7);system("cls");for(int x=1; x<13;x++){if(x==1x==3x==5x==7x==8x==10x==12)i=31;else if(x==4x==6x==9x==11)i=30;else if(x==2 && c==0)i=29;elsei=28;if(x==1)cout<<setw(9)<<"January"<<endl<<endl;if(x==2)cout<<setw(9)<<"February"<<endl<<endl;if(x==3)cout<<setw(9)<<"March"<<endl<<endl;if(x==4)cout<<setw(9)<<"April"<<endl<<endl;if(x==5)cout<<setw(9)<<"May"<<endl<<endl;if(x==6)cout<<setw(9)<<"June"<<endl<<endl;if(x==7)cout<<setw(9)<<"July"<<endl<<endl;if(x==8)cout<<setw(9)<<"August"<<endl<<endl;if(x==9)cout<<setw(9)<<"September"<<endl<<endl;if(x==10)cout<<setw(9)<<"October"<<endl<<endl;if(x==11)

Tidak ada komentar:

Posting Komentar