U E D R , A S I H C RSS

10학번 c++ 프로젝트/소스

main.cpp

..by.AllMemberz

#include <windows.h>
#include "now_time.h"
#include "alarmsetting.h"
#include "cho.h"

void main()	{

	while(1)	{
		now_time a;
		a.print_now_time();
		system("cls");
		cho b;
		b.setwatch();
		system("cls");
		alarmsetting c;
		c.alm_set();
	}
}

now_time.cpp

by.,

/***********************************************************
* //////////////////
*
*     ㅋㅋㅋㅋ
*   ... ;;( 1 : 1.618  5:8 ...)
*   ... ;;
*   ... ;;
*   ...ㅡ,.ㅜ;;
*                                     By  
***********************************************************/

#include <iostream>
#include <time.h>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include "now_time.h"
using namespace std;
typedef enum { NOCURSOR, SOLIDCURSOR, NORMALCURSOR } CURSOR_TYPE;

extern int ah;
extern int am;
extern int as;
void gotoxy(int x, int y)
{
	COORD Cur;
	Cur.X=x;
	Cur.Y=y;
	SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),Cur);
}
void setcursortype(CURSOR_TYPE c)
{
	CONSOLE_CURSOR_INFO CurInfo;

	switch (c) {
	case NOCURSOR:
		CurInfo.dwSize=1;
		CurInfo.bVisible=FALSE;
		break;
	case SOLIDCURSOR:
		CurInfo.dwSize=100;
		CurInfo.bVisible=TRUE;
		break;
	case NORMALCURSOR:
		CurInfo.dwSize=20;
		CurInfo.bVisible=TRUE;
		break;
	}
	SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&CurInfo);
}
void now_time::print_now_time()
{
	
	char arr[10][8][16]={		// digit 
		{{"  ■■■  "},			
		{"■      ■"},
		{"■      ■"},			
		{"■      ■"},			//     .
		{"■      ■"},
		{"■      ■"},
		{"■      ■"},
		{"  ■■■  "}},
		{{"    ■    "},
		{"  ■■    "},
		{"■  ■    "},
		{"    ■    "},
		{"    ■    "},
		{"    ■    "},
		{"    ■    "},
		{"■■■■■"}},
		{{"  ■■■  "},
		{"■      ■"},
		{"■      ■"},
		{"        ■"},
		{"      ■  "},
		{"    ■    "},
		{"  ■      "},
		{"■■■■■"}},
		{{"  ■■■  "},
		{"■      ■"},
		{"        ■"},
		{"    ■■  "},
		{"        ■"},
		{"        ■"},
		{"■      ■"},
		{"  ■■■  "}},
		{{"      ■  "},
		{"    ■■  "},
		{"  ■  ■  "},
		{"■    ■  "},
		{"■■■■■"},
		{"      ■  "},
		{"      ■  "},
		{"      ■  "}},
		{{"■■■■■"},
		{"■        "},
		{"■        "},
		{"  ■■■  "},
		{"        ■"},
		{"■      ■"},
		{"■      ■"},
		{"  ■■■  "}},
		{{"  ■■■  "},
		{"■        "},
		{"■        "},
		{"■■■■  "},
		{"■      ■"},
		{"■      ■"},
		{"■      ■"},
		{"  ■■■  "}},
		{{"■■■■■"},
		{"■      ■"},
		{"        ■"},
		{"      ■  "},
		{"    ■    "},
		{"    ■    "},
		{"    ■    "},
		{"    ■    "}},
		{{"  ■■■  "},
		{"■      ■"},
		{"■      ■"},
		{"  ■■■  "},
		{"■      ■"},
		{"■      ■"},
		{"■      ■"},
		{"  ■■■  "}},
		{{"  ■■■  "},
		{"■      ■"},
		{"■      ■"},
		{"  ■■■■"},
		{"        ■"},
		{"        ■"},
		{"        ■"},
		{"  ■■■  "}
		}
	};

		setcursortype(NOCURSOR);	// .


		time_t a;
		tm* b;
		int h,m,s;
		while(1){
			char key;
			if(kbhit())
			{
				key=getch();
				if(key=='1')
					break;
	
			}
			
			system("cls");
			gotoxy(24,2);				// ( : ) 
			cout<<"□";
			gotoxy(24,5);
			cout<<"□";
			gotoxy(52,2);
			cout<<"□";
			gotoxy(52,5);
			cout<<"□";

			time(&a);			// 
			b=localtime(&a);

			h = b->tm_hour;		//
			m = b->tm_min;		//
			s = b->tm_sec;		//
			if((ah == h)&&(am==m)&&(as==s))
			{
				printf("\a\a\a");
			}
			int h10 = h/10;			//,,  10, 1  
			int h1 = h%10;
			int m10 = m/10;
			int m1 = m%10;
			int s10 = s/10;
			int s1 = s%10;

			for(int x=0;x<8;x++){		//,  6 1 
				gotoxy(0,x);
				cout<<arr[h10][x];
				gotoxy(12,x);
				cout<<arr[h1][x];

				gotoxy(28,x);
				cout<<arr[m10][x];
				gotoxy(40,x);
				cout<<arr[m1][x];

				gotoxy(56,x);
				cout<<arr[s10][x];
				gotoxy(68,x);
				cout<<arr[s1][x];
			}
			Sleep(1000);				// 1 함 (  sleep!!.    1000 )
		}
}

cho.cpp

통~ by.,

#include "cho.h"
#include <iostream>
#include <iomanip>
#include <conio.h>
#include <windows.h>
cho::cho()
{
	chk=0;
	clock2=0;
	prog_exit=false;
}
cho::~cho()
{
}
void cho::setwatch()
{
	
	
	std::cout<<"0 : 00 : 00";

	
	char key=getch();
	while(1)
	{ 

		if(prog_exit) break; // 한 
		if(chk==0) //0   태
		{
			if(key=='1') //  환
			{
				prog_exit=true;
			}
			if(key=='3') // 
			{
				chk=1;
				Fulls=GetTickCount();
				while(1)
				{
					clock=GetTickCount()-Fulls+clock2;
					rs=clock/1000;
					s=rs%60;
					m=clock/60000;
					rms=clock%1000;
					ms=rms/10;
					system("cls");
					std::cout<<m<<" : "<<std::setw(2)<<std::setfill('0')<<s<<" : "<<std::setw(2)<<std::setfill('0')<<ms<<std::endl;


					if(kbhit())
					{
						key=getch();
						break;
					}


				}

			}
		}
		if(chk==1) // 
		{

			if(key=='3') //
			{
				chk=2;
				system("cls");
				std::cout<<m<<" : "<<std::setw(2)<<std::setfill('0')<<s<<" : "<<std::setw(2)<<std::setfill('0')<<ms<<std::endl;
				key=getch();

			}
			if(key=='1') //  환
			{
				prog_exit=true;
			}

		}
		if(chk==2) // 
		{

			if(key=='2')
			{
				clock=0;
				system("cls");
				std::cout<<"0 : 00 : 00";

				key=getch();
				chk=0;


			}
			if(key=='1') //  환
			{
				prog_exit=true;
			}
			if(key=='3') //   
			{
				Fulls=GetTickCount();
				while(1)
				{
					clock2=(GetTickCount()-Fulls)+clock;
					rs=clock2/1000;
					s=rs%60;
					m=clock2/60000;
					rms=clock2%1000;
					ms=rms/10;
					system("cls");
					std::cout<<m<<" : "<<std::setw(2)<<std::setfill('0')<<s<<" : "<<std::setw(2)<<std::setfill('0')<<ms<<std::endl;

					if(kbhit())
					{
						chk=1;
						clock=clock2;
						key=getch();
						break;

					}
				}
			}
			if(key=='1') //  환
			{
				prog_exit=true;
			}
		}

	}

} 

alarmsetting.cpp

함 by.,

//made by 혜
// 10.07.15
//ver. 
#include<iostream>
#include <stdio.h>
#include <stdlib.h>
#include<conio.h>
#include"alarmsetting.h"
using namespace std;
struct altm{
 int altm_hour;
 int altm_min;
 int altm_sec; 
}settm;
int ah,am,as;
void alarmsetting::alm_set()
{
	
 char button; //  1,2,3....

 struct altm settm;
 settm.altm_hour=00;
 settm.altm_min=00;
 settm.altm_sec=00;

 int* a; //   

 a=&settm.altm_hour;//   
 
 printf("■■    ■■\n");
 printf("\n");
 printf("%2d%2d%2d\n",settm.altm_hour,settm.altm_min,settm.altm_sec);
 printf("\n");
 printf("1:, 2:↑, 3:→\n");
 printf("\n");
 //printf("1:mode ,2:reset ,3:start/stop\n");

 

 for(;;)
 { 
  button=getch();//   ...

  if(button=='1')break;//    

  if(button=='2'){//   . function  ...
   system("cls");

   *a += 1;

   if(settm.altm_hour==25)settm.altm_hour=00;
   if(settm.altm_min==60)settm.altm_min=00;
   if(settm.altm_sec==60)settm.altm_sec=00;

   printf("■■    ■■\n");
   printf("\n");
   printf("%2d%2d%2d\n",settm.altm_hour,settm.altm_min,settm.altm_sec);
   printf("\n");
   printf("1:, 2:↑, 3:→\n");
   printf("\n");
   //printf("1:mode ,2:reset ,3:start/stop\n");
  }

  if(button=='3'){//    .  function ....
   system("cls");

   if(a==&settm.altm_hour) a = &settm.altm_min; 
   else if(a==&settm.altm_min) a = &settm.altm_sec; 
   else if(a==&settm.altm_sec) a = &settm.altm_hour; 

   printf("■■    ■■\n");
   printf("\n");
   printf("%2d%2d%2d\n",settm.altm_hour,settm.altm_min,settm.altm_sec);
   printf("\n");
   printf("1:, 2:↑, 3:→\n");
   printf("\n");
   //printf("1:mode ,2:reset ,3:start/stop\n");
  }


 }


 system("cls");

 if((settm.altm_hour==00)&&(settm.altm_min==00)&&(settm.altm_sec==00)){
  printf("■■   ㅜ_ㅜ !■■\n");
 }

 else {
  printf("■■   ㅋ_ㅋ !■■\n");
  printf("\n");
  printf(" %d %d %d !\n",settm.altm_hour,settm.altm_min,settm.altm_sec);
  printf("\n");

  ah = settm.altm_hour;
  am = settm.altm_min;
  as = settm.altm_sec;
 }
 //    ...


}



/*, function      
        ㅎㅎ
? */

now_time.h

#pragma once
class now_time {

public:
	void print_now_time();
};

cho.h

#pragma once
class cho	{
private:
	int chk;
	int m,s,ms;
	int rs,rms;
	int clock;
	int clock2;
	int Fulls;
	bool prog_exit;
public:
	void setwatch();
	cho();
	~cho();

};

alarmsetting.h

#pragma once
class alarmsetting
{
public:
	
	void alm_set();
};

alarm.h

alarmsetting now_time

#pragma once
int alm_h;
int alm_m;
int alm_s;
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:06
Processing time 0.0216 sec