Welcome to Home.

Monday, February 22, 2016

Birthday calculator in C++ By Saroj Dahal

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

class birth   // Creating class named birth
 {

public:
void display_main()
{
 char name[10];
 int var_year=0,var_month=0,var_day=0,age=0,month=0,day=0;
 int con_year=0,con_month=0,con_day=0;
 cout<<"\n\n\t\t`````````````````````````````````````````";
 cout<<"\n\t                   BIRTDAY CALCULATOR             ";
 cout<<"\n\t\t``````````````````````````````````````````";
 cout<<"\n\t\tEnter Present Year    :20";
 cin>>con_year;
 cout<<"\t\tEnter Present Month   :";
 cin>>con_month;
 cout<<"\t\tEnter Today Date      :";
 cin>>con_day;
 cout<<"\t\t______________________________\n\n";
 cout<<"\t\tEnter Your Name       :";
 cin>>name;
 line2:
 cout<<"\t\tEnter Birth Year      :20";
 cin>>var_year;
 cout<<"\t\tEnter Birth Month     :";
 cin>>var_month;
 cout<<"\t\tEnter Birth Date      :";
 cin>>var_day;
 cout<<"\t\t******************************************";
 age=con_year-var_year;
 cout<<"\n\n\t\t\tHi "<<name;
 cout<<" Your Age is:"<<age;
 if(var_month>con_month)
 {
month=var_month-con_month;
cout<<"\n\t\t\tMonths Remaining:"<<month;
if(con_day>var_day)
{
day=con_day-var_day;
cout<<"\n\t\t\tDays Reamining:"<<day;
}
else
{
day=var_day-con_day;
cout<<"\n\t\t\tDays Remaining:"<<day;
 }
 }
 else
 {
month=con_month-var_month;
cout<<"\n\t\t\tMonths Before :"<<month;
if(con_day>var_day)
{
day=con_day-var_day;
cout<<"\n\t\t\tDays Before:"<<day;
}
else
{
day=var_day-con_day;
cout<<"\n\t\t\tDays Before:"<<day;
}
}//end of if else Statement
}// end of Function
 };
void loading()
{
gotoxy(12,15);
cout<<"\t\t\tLOADING...\n";
cout<<"\xDB\xDB\xDB";
sleep(5);
cout<<"\xDB\xDB\xDB";
sleep(4);
cout<<"\xDB\xDB\xDB\xDB\xDB\xDB\xDB";
sleep(3);
cout<<"\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB";
sleep(2);
cout<<"\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB";
sleep(1);
cout<<"\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB";
sleep(1);
cout<<"\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB";
}

 void main()
 {
 line1:
 clrscr();
 loading();
 clrscr();
 birth print;
 print.display_main();
 char reply='n';
cout<<"\n\t\t*****************************************";
cout<<"\n\t\t Do you want to continue?(y=Yes and n=No) \n\t\t Ans. ";
     cin>>reply;
     if(reply=='y')
     {
     goto line1;
     }
     else
     {
     clrscr();
     gotoxy(28,12);
     cout<<"VISIT AGAIN!!";
     gotoxy(25,15);
     cout<<"Program's Developer Information:";
     cout<<"\n\t\t_______________________________________________________";
     gotoxy(25,17);
     cout<<"Name     : Saroj Dahal";
     cout<<"\n\t\t\tAddress  : Vyas-11 Damauli,Tanahun,Nepal";
     cout<<"\n\t\t\tFacebook :saroj.dahal.1213@facebook.com";
     cout<<"\n\t\t________________________________________________________";
     cout<<"\n\t\tThis Program was made in 2014 July 10 (2071 Ashar 26) Friday";
     }
 getch();
 }

No comments:

Post a Comment