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

class  ALARM
{
public :
struct time t;
int m,h,a,b;
void resetalarm()
    {
    ofstream x("D:\\hour.txt"),y("D:\\minute.txt");
    a=0,b=0;
    x<<a;y<<b;
    x.close();y.close();
    }
void setalarm()
    {
    ofstream x("D:\\hour.txt"),y("D:\\minute.txt");
    cout<<"\n\n\t\t\t\tEnter hour\n";
    cin>>a;
    cout<<"\n\n\t\t\t\tEnter minute\n";
    cin>>b;
    x<<a;y<<b;
    x.close();y.close();
    }
void alarmmatch()
    {
    ifstream i("D:\\hour.txt"),j("D:\\minute.txt");
    i>>a;
    j>>b;
    i.close();j.close();
    gettime(&t);
    m=t.ti_min,h=t.ti_hour;
    if(h==a&&m==b)
    {cout<<"\n\n\t\t\t\tTime of alarm\a\n";}
    }
};
class reminder
{
public :
struct time t;
struct date d;
int m,h,set_0_1,set_0_2,da,mo ,ye,set_0_3,set_0_4,set_0_5;
char a[50];
void rerem()
    {
    ofstream p("E:\\hour.txt");
    ofstream q("E:\\minute.txt");
    ofstream r("E:\\remind.txt");
    ofstream s("E:\\date.txt");
    ofstream t("E:\\month.txt");
    ofstream w("E:\\year.txt");
    set_0_1=0,set_0_2=0,set_0_3=0,set_0_4=0,set_0_5=0;
    p<<set_0_1;
    q<<set_0_2;

    s<<set_0_3;
    t<<set_0_4;
    w<<set_0_5;

    p.close();
    q.close();
    r.close();
    s.close();
    t.close();
    w.close();
    }
void setrem()
    {
    ofstream p("E:\\hour.txt");
    ofstream q("E:\\minute.txt");
    ofstream r("E:\\remind.txt");
    ofstream s("E:\\date.txt");
    ofstream t("E:\\month.txt");
    ofstream w("E:\\year.txt");
    cout<<"\n\n\t\t\t\tEnter hour\n";
    cin>>set_0_1;
    cout<<"\n\n\t\t\t\tEnter minute\n";
    cin>>set_0_2;
    cout<<"\n\n\t\t\t\tEnter date\n";
    cin>>set_0_3;
    cout<<"\n\n\t\t\t\tEnter month\n";
    cin>>set_0_4;
    cout<<"\n\n\t\t\t\tEnter year\n";
    cin>>set_0_5;

    cout<<"\n\nmessage:";
    cin>>a;
    p<<set_0_1;
    q<<set_0_2;
    r<<a;
    s<<set_0_3;
    t<<set_0_4;
    w<<set_0_5;
    p.close();
    q.close();
    r.close();
    s.close();
    t.close();
    w.close();
    }
void remmatch()
    {
    ifstream i("E:\\hour.txt");
    ifstream j("E:\\minute.txt");
    ifstream k("E:\\remind.txt");
    ifstream z("E:\\date.txt");
    ifstream e("E:\\month.txt");
    ifstream f("E:\\year.txt");
    i>>set_0_1;
    j>>set_0_2;
    k>>a;
    z>>set_0_3;
    e>>set_0_4;
    f>>set_0_5;
    i.close();
    j.close();
    k.close();
    z.close();
    e.close();
    f.close();
    gettime(&t);
    m=t.ti_min,h=t.ti_hour;
    getdate(&d);
    da=d.da_day,mo=d.da_mon,ye=d.da_year;
    if(h==set_0_1&&m==set_0_2&&da==d.da_day&&mo==d.da_mon&&ye==d.da_year)
    {cout<<"\n\n\t\t\t\t"<<a;}
    }
};

class TIME
{
public :
struct time t;
int s,m,h,p;
void showclock()
    {
    gettime(&t);
    s=t.ti_sec,m=t.ti_min,h=t.ti_hour;
    for(p=1;p<=15;p++)
    {
    cout<<"\n";
    }
    textcolor(3);
    cout<<"\t\t\t";

    cprintf("        %2d:%02d:%02d",h,m,s);
    }
};
class DATE
{
    public :
    int newdate;
     struct date d;
    int p,m,y;
    void showdate()
    {
    getdate(&d);
    p=d.da_day;
    m=d.da_mon;
    y=d.da_year;
    cout<<"\n\n\t\t\t\t"<<p<<"-"<<m<<"-"<<y;

        newdate=(p + (2 * m)+((6*(m+1))/10)+y+(y/4)-(y/100)+(y/400)+1)%7;

          switch (newdate)
    {
        case 0:
        {
            puts("\n\n\t\t\t\tThe day is Sunday.");
            break;
        }
        case 1:
        {
            puts("\n\n\t\t\t\tThe day is Monday.");
            break;
        }
        case 2:
        {
            puts("\n\n\t\t\t\tThe day is Tuesday.");
            break;
        }
        case 3:
        {
            puts("\n\n\t\t\t\tThe day is Wednesday.");
            break;
        }
        case 4:
        {
            puts("\n\n\t\t\t\tThe day is Thursday.");
            break;
        }
        case 5:
        {
            puts("\n\n\t\t\t\tThe day is Friday.");
            break;
        }
        case 6:
        {
            puts("\n\n\t\t\t\tThe day is Saturday.");
            break;
        }
    }
    }
};

class STOP
{
    int b;
    public:
    int newdate;
    STOP(){}
    STOP(int l){b=l;}
    void display()
    {
    int j,m,h,s,ms,a;
    ms=b%100;
    a=b/100;
    s=a%60;
    j=a/60;
    m=j%60;
    h=a/3600;
    cout<<"\n\n\t\t\t\t";
      cout<<h<<":"<<m<<":"<<s<<":"<<ms;
    }
};

class ROUTINE:public DATE
{
   public:
       int newdate;
       void showr()
       {
    getdate(&d);
    p=d.da_day;
    m=d.da_mon;
    y=d.da_year;

     clrscr();
        newdate=(p + (2 * m)+((6*(m+1))/10)+y+(y/4)-(y/100)+(y/400)+1)%7;
    if (newdate==0){
     cout<<"\nTIME/DATE  8.00  8.50   9.40   b   10.40  11.30  12.20  b   2.30   3.20   4.10     ";
     cout<<"\n            to    to     to    r     to     to    to    r    to     to     to      ";
     cout<<"\n           8.50  9.40   10.30  e   11.30  12.20  1.10   e   3.20   4.10   5.00     ";
     cout<<"\nSunday                   EE    a    CE    IEM     EE    a   ------EE2108------     ";
     cout<<"\n            -     -     2109   k   2109   2103   2107   k   ------CE2104------     ";}
    else if(newdate==1){
     cout<<"\nTIME/DATE  8.00  8.50   9.40   b   10.40  11.30  12.20  b   2.30   3.20   4.10     ";
     cout<<"\n            to    to     to    r     to     to    to    r    to     to     to      ";
     cout<<"\n           8.50  9.40   10.30  e   11.30  12.20  1.10   e   3.20   4.10   5.00     ";
     cout<<"\nMonday     ------EE2122-----   a   MATH     -    IEM    a   ------EE2110------     ";
     cout<<"\n                               k   2103          2103   k   ------------------     ";}
    else if(newdate==2){
     cout<<"\nTIME/DATE  8.00  8.50   9.40   b   10.40  11.30  12.20  b   2.30   3.20   4.10     ";
     cout<<"\n            to    to     to    r     to     to    to    r    to     to     to      ";
     cout<<"\n           8.50  9.40   10.30  e   11.30  12.20  1.10   e   3.20   4.10   5.00     ";
     cout<<"\nTuesday     CE   IEM    EE     a   ----EE2110--------   a    -      -      -       ";
     cout<<"\n           2103  2103  2109    k                        k                          ";}
    else if(newdate==3){
     cout<<"\nTIME/DATE  8.00  8.50   9.40   b   10.40  11.30  12.20  b   2.30   3.20   4.10     ";
     cout<<"\n            to    to     to    r     to     to    to    r    to     to     to      ";
     cout<<"\n           8.50  9.40   10.30  e   11.30  12.20  1.10   e   3.20   4.10   5.00     ";
     cout<<"\nWednesday   EE    -      -     a   MATH     -     -     a    -      -      -       ";
     cout<<"\n           2107                k   2103                 k                          ";}
    else if(newdate==4){
     cout<<"\nTIME/DATE  8.00  8.50   9.40   b   10.40  11.30  12.20  b   2.30   3.20   4.10     ";
     cout<<"\n            to    to     to    r     to     to    to    r    to     to     to      ";
     cout<<"\n           8.50  9.40   10.30  e   11.30  12.20  1.10   e   3.20   4.10   5.00     ";
     cout<<"\nThursday    EE    EE     CE    a   MATH     -     -     a   ------EE2122------     ";
     cout<<"\n           2107  2107   2109   k   2103                 k   ------------------     ";}
    else if(newdate==5)
     {cout<<"\n\tToday is holiday ,no class no pressure so relax";}
    else if(newdate==6)
     {cout<<"\n\tToday is holiday, no class no pressure so relax";}
    cout<<"\n\n\tPress any key to back";
     getch();

       }
};
class SET : public ALARM,public reminder
{
public :
void show()
  {int p;
  for(p=1;p<=10;p++)
  {cout<<"\n";}
  cout<<"\tSETTINGS:\n\n";
  cout<<"Press 1 to reset & start stopwatch\n\n";
  cout<<"press 2 to restart stopwatch\n\n";
  cout<<"Press 3 to stop stopwatch\n\n";
  cout<<"Press 4 to set alarm\n\n";
  cout<<"Press 5 to reset alarm\n\n";
  cout<<"Press 6 to see routine\n\n";
  cout<<"Press 7 to set reminder\n\n";
  cout<<"Press 8 to reset reminder\n\n";
  cout<<"Press 9 to exit\n\n";


  }
};

void main ()
{
int i,x,y;
TIME A;
DATE B;
SET C;
ROUTINE R;
reminder e;
clrscr();
start:
while(!kbhit())
{
delay(1000);
clrscr();
     A.showclock();
     B.showdate();
     C.alarmmatch();
     e.remmatch();
     cout<<"\n\n\t\t\t\tPress any key for settings\n";
     } getch();
setting:
C.show();
cin>>y;
 if(y==2)
 { x=2; goto start1;  }
  else if(y==1)
  { i=0; x=2;  goto start1; }
   else if(y==3)
  { i=0; x=4;  goto start; }
  else if(y==4)
  {C.setalarm(); goto start; }
   else if(y==5)
  {C.resetalarm(); goto start; }
  else if(y==6)
  {R.showr();goto start;}
  else if(y==7)
  {e.setrem();goto start;}
  else if(y==8)
  {e.rerem();goto start;}
  else
  { goto end;}
i=0;
start1:
while(!kbhit())
{
delay(10);
clrscr();
if(x==2)
 {
i=i+1;
STOP S(i);
S.display();
  }

}
getch();
goto setting;

  end:


}

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

class ALARM
{
public :
struct time t;
int m,h,a,b;
void resetalarm()
{
ofstream x("D:\\hour.txt"),y("D:\\minute.txt");
a=0,b=0;
x<<a;y<<b;
x.close();y.close();
}
void setalarm()
{
ofstream x("D:\\hour.txt"),y("D:\\minute.txt");
cout<<"\n\n\t\t\t\tEnter hour\n";
cin>>a;
cout<<"\n\n\t\t\t\tEnter minute\n";
cin>>b;
x<<a;y<<b;
x.close();y.close();
}
void alarmmatch()
{
ifstream i("D:\\hour.txt"),j("D:\\minute.txt");
i>>a;
j>>b;
i.close();j.close();
gettime(&t);
m=t.ti_min,h=t.ti_hour;
if(h==a&&m==b)
{cout<<"\n\n\t\t\t\tTime of alarm\a\n";}
}
};
class reminder
{
public :
struct time t;
struct date d;
int m,h,set_0_1,set_0_2,da,mo ,ye,set_0_3,set_0_4,set_0_5;
char a[50];
void rerem()
{
ofstream p("E:\\hour.txt");
ofstream q("E:\\minute.txt");
ofstream r("E:\\remind.txt");
ofstream s("E:\\date.txt");
ofstream t("E:\\month.txt");
ofstream w("E:\\year.txt");
set_0_1=0,set_0_2=0,set_0_3=0,set_0_4=0,set_0_5=0;
p<<set_0_1;
q<<set_0_2;

s<<set_0_3;
t<<set_0_4;
w<<set_0_5;

p.close();
q.close();
r.close();
s.close();
t.close();
w.close();
}
void setrem()
{
ofstream p("E:\\hour.txt");
ofstream q("E:\\minute.txt");
ofstream r("E:\\remind.txt");
ofstream s("E:\\date.txt");
ofstream t("E:\\month.txt");
ofstream w("E:\\year.txt");
cout<<"\n\n\t\t\t\tEnter hour\n";
cin>>set_0_1;
cout<<"\n\n\t\t\t\tEnter minute\n";
cin>>set_0_2;
cout<<"\n\n\t\t\t\tEnter date\n";
cin>>set_0_3;
cout<<"\n\n\t\t\t\tEnter month\n";
cin>>set_0_4;
cout<<"\n\n\t\t\t\tEnter year\n";
cin>>set_0_5;

cout<<"\n\nmessage:";
cin>>a;
p<<set_0_1;
q<<set_0_2;
r<<a;
s<<set_0_3;
t<<set_0_4;
w<<set_0_5;
p.close();
q.close();
r.close();
s.close();
t.close();
w.close();
}
void remmatch()
{
ifstream i("E:\\hour.txt");
ifstream j("E:\\minute.txt");
ifstream k("E:\\remind.txt");
ifstream z("E:\\date.txt");
ifstream e("E:\\month.txt");
ifstream f("E:\\year.txt");
i>>set_0_1;
j>>set_0_2;
k>>a;
z>>set_0_3;
e>>set_0_4;
f>>set_0_5;
i.close();
j.close();
k.close();
z.close();
e.close();
f.close();
gettime(&t);
m=t.ti_min,h=t.ti_hour;
getdate(&d);
da=d.da_day,mo=d.da_mon,ye=d.da_year;
if(h==set_0_1&&m==set_0_2&&da==d.da_day&&mo==d.da_mon&&ye==d.da_year)
{cout<<"\n\n\t\t\t\t"<<a;}
}
};

class TIME
{
public :
struct time t;
int s,m,h,p;
void showclock()
{
gettime(&t);
s=t.ti_sec,m=t.ti_min,h=t.ti_hour;
for(p=1;p<=15;p++)
{
cout<<"\n";
}
textcolor(3);
cout<<"\t\t\t";

cprintf(" %2d:%02d:%02d",h,m,s);
}
};
class DATE
{
public :
int newdate;
struct date d;
int p,m,y;
void showdate()
{
getdate(&d);
p=d.da_day;
m=d.da_mon;
y=d.da_year;
cout<<"\n\n\t\t\t\t"<<p<<"-"<<m<<"-"<<y;

newdate=(p + (2 * m)+((6*(m+1))/10)+y+(y/4)-(y/100)+(y/400)+1)%7;

switch (newdate)
{
case 0:
{
puts("\n\n\t\t\t\tThe day is Sunday.");
break;
}
case 1:
{
puts("\n\n\t\t\t\tThe day is Monday.");
break;
}
case 2:
{
puts("\n\n\t\t\t\tThe day is Tuesday.");
break;
}
case 3:
{
puts("\n\n\t\t\t\tThe day is Wednesday.");
break;
}
case 4:
{
puts("\n\n\t\t\t\tThe day is Thursday.");
break;
}
case 5:
{
puts("\n\n\t\t\t\tThe day is Friday.");
break;
}
case 6:
{
puts("\n\n\t\t\t\tThe day is Saturday.");
break;
}
}
}
};

class STOP
{
int b;
public:
int newdate;
STOP(){}
STOP(int l){b=l;}
void display()
{
int j,m,h,s,ms,a;
ms=b%100;
a=b/100;
s=a%60;
j=a/60;
m=j%60;
h=a/3600;
cout<<"\n\n\t\t\t\t";
cout<<h<<":"<<m<<":"<<s<<":"<<ms;
}
};

class ROUTINE:public DATE
{
public:
int newdate;
void showr()
{
getdate(&d);
p=d.da_day;
m=d.da_mon;
y=d.da_year;

clrscr();
newdate=(p + (2 * m)+((6*(m+1))/10)+y+(y/4)-(y/100)+(y/400)+1)%7;
if (newdate==0){
cout<<"\nTIME/DATE 8.00 8.50 9.40 b 10.40 11.30 12.20 b 2.30 3.20 4.10 ";
cout<<"\n to to to r to to to r to to to ";
cout<<"\n 8.50 9.40 10.30 e 11.30 12.20 1.10 e 3.20 4.10 5.00 ";
cout<<"\nSunday EE a CE IEM EE a ------EE2108------ ";
cout<<"\n - - 2109 k 2109 2103 2107 k ------CE2104------ ";}
else if(newdate==1){
cout<<"\nTIME/DATE 8.00 8.50 9.40 b 10.40 11.30 12.20 b 2.30 3.20 4.10 ";
cout<<"\n to to to r to to to r to to to ";
cout<<"\n 8.50 9.40 10.30 e 11.30 12.20 1.10 e 3.20 4.10 5.00 ";
cout<<"\nMonday ------EE2122----- a MATH - IEM a ------EE2110------ ";
cout<<"\n k 2103 2103 k ------------------ ";}
else if(newdate==2){
cout<<"\nTIME/DATE 8.00 8.50 9.40 b 10.40 11.30 12.20 b 2.30 3.20 4.10 ";
cout<<"\n to to to r to to to r to to to ";
cout<<"\n 8.50 9.40 10.30 e 11.30 12.20 1.10 e 3.20 4.10 5.00 ";
cout<<"\nTuesday CE IEM EE a ----EE2110-------- a - - - ";
cout<<"\n 2103 2103 2109 k k ";}
else if(newdate==3){
cout<<"\nTIME/DATE 8.00 8.50 9.40 b 10.40 11.30 12.20 b 2.30 3.20 4.10 ";
cout<<"\n to to to r to to to r to to to ";
cout<<"\n 8.50 9.40 10.30 e 11.30 12.20 1.10 e 3.20 4.10 5.00 ";
cout<<"\nWednesday EE - - a MATH - - a - - - ";
cout<<"\n 2107 k 2103 k ";}
else if(newdate==4){
cout<<"\nTIME/DATE 8.00 8.50 9.40 b 10.40 11.30 12.20 b 2.30 3.20 4.10 ";
cout<<"\n to to to r to to to r to to to ";
cout<<"\n 8.50 9.40 10.30 e 11.30 12.20 1.10 e 3.20 4.10 5.00 ";
cout<<"\nThursday EE EE CE a MATH - - a ------EE2122------ ";
cout<<"\n 2107 2107 2109 k 2103 k ------------------ ";}
else if(newdate==5)
{cout<<"\n\tToday is holiday ,no class no pressure so relax";}
else if(newdate==6)
{cout<<"\n\tToday is holiday, no class no pressure so relax";}
cout<<"\n\n\tPress any key to back";
getch();

}
};
class SET : public ALARM,public reminder
{
public :
void show()
{int p;
for(p=1;p<=10;p++)
{cout<<"\n";}
cout<<"\tSETTINGS:\n\n";
cout<<"Press 1 to reset & start stopwatch\n\n";
cout<<"press 2 to restart stopwatch\n\n";
cout<<"Press 3 to stop stopwatch\n\n";
cout<<"Press 4 to set alarm\n\n";
cout<<"Press 5 to reset alarm\n\n";
cout<<"Press 6 to see routine\n\n";
cout<<"Press 7 to set reminder\n\n";
cout<<"Press 8 to reset reminder\n\n";
cout<<"Press 9 to exit\n\n";


}
};

void main ()
{
int i,x,y;
TIME A;
DATE B;
SET C;
ROUTINE R;
reminder e;
clrscr();
start:
while(!kbhit())
{
delay(1000);
clrscr();
A.showclock();
B.showdate();
C.alarmmatch();
e.remmatch();
cout<<"\n\n\t\t\t\tPress any key for settings\n";
} getch();
setting:
C.show();
cin>>y;
if(y==2)
{ x=2; goto start1; }
else if(y==1)
{ i=0; x=2; goto start1; }
else if(y==3)
{ i=0; x=4; goto start; }
else if(y==4)
{C.setalarm(); goto start; }
else if(y==5)
{C.resetalarm(); goto start; }
else if(y==6)
{R.showr();goto start;}
else if(y==7)
{e.setrem();goto start;}
else if(y==8)
{e.rerem();goto start;}
else
{ goto end;}
i=0;
start1:
while(!kbhit())
{
delay(10);
clrscr();
if(x==2)
{
i=i+1;
STOP S(i);
S.display();
}

}
getch();
goto setting;

end:


}

No code tags.
Non-standard code.
Spaghetti code.
Double Post.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.