Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

10학번 c++ 프로젝트/소스: Difference between revisions

From ZeroWiki
imported>rlaace423
No edit summary
imported>rlaace423
No edit summary
Line 155: Line 155:
  {"        ■"},
  {"        ■"},
  {"        ■"},
  {"        ■"},
  {"  ■■■  "
  {"  ■■■  "}
;
}
 
};
setcursortype(NOCURSOR); //커서를 숨긴다.
 
setcursortype(NOCURSOR); //커서를 숨긴다.
 
time_t a;
tm* b;
time_t a;
int h,m,s;
tm* b;
while(1){
int h,m,s;
char key;
while(1){
if(kbhit())
char key;
{
if(kbhit())
key=getch();
{
if(key=='1')
key=getch();
break;
if(key=='1')
break;
}
}
system("cls");
gotoxy(24,2); // 땡땡( : ) 입력
system("cls");
cout<<"□";
gotoxy(24,2); // 땡땡( : ) 입력
gotoxy(24,5);
cout&lt;&lt;"□";
cout<<"□";
gotoxy(24,5);
gotoxy(52,2);
cout&lt;&lt;"□";
cout<<"□";
gotoxy(52,2);
gotoxy(52,5);
cout&lt;&lt;"□";
cout<<"□";
gotoxy(52,5);
 
cout&lt;&lt;"□";
time(&a); //시스템 시간 받아오기
b=localtime(&a);
time(&amp;a); //시스템 시간 받아오기
 
b=localtime(&amp;a);
h = b->tm_hour; //시
m = b->tm_min; //분
h = b-&gt;tm_hour; //시
s = b->tm_sec; //초
m = b-&gt;tm_min; //분
if((ah == h)&&(am==m)&&(as==s))
s = b-&gt;tm_sec; //초
{
if((ah == h)&amp;&amp;(am==m)&amp;&amp;(as==s))
printf("\a\a\a");
{
}
printf("\a\a\a");
int h10 = h/10; //시,분,초 각각의 10, 1의 자리 구하기
}
int h1 = h%10;
int h10 = h/10; //시,분,초 각각의 10, 1의 자리 구하기
int m10 = m/10;
int h1 = h%10;
int m1 = m%10;
int m10 = m/10;
int s10 = s/10;
int m1 = m%10;
int s1 = s%10;
int s10 = s/10;
 
int s1 = s%10;
for(int x=0;x<8;x++){ //위에서부터 한줄씩, 총 6줄 1초마다 출력
gotoxy(0,x);
for(int x=0;x&lt;8;x++){ //위에서부터 한줄씩, 총 6줄 1초마다 출력
cout<<arr&#91;h10&#93;&#91;x&#93;;
gotoxy(0,x);
gotoxy(12,x);
cout&lt;&lt;arr[h10][x];
cout<<arr&#91;h1&#93;&#91;x&#93;;
gotoxy(12,x);
 
cout&lt;&lt;arr[h1][x];
gotoxy(28,x);
cout<<arr&#91;m10&#93;&#91;x&#93;;
gotoxy(28,x);
gotoxy(40,x);
cout&lt;&lt;arr[m10][x];
cout<<arr&#91;m1&#93;&#91;x&#93;;
gotoxy(40,x);
 
cout&lt;&lt;arr[m1][x];
gotoxy(56,x);
cout<<arr&#91;s10&#93;&#91;x&#93;;
gotoxy(56,x);
gotoxy(68,x);
cout&lt;&lt;arr[s10][x];
cout<<arr&#91;s1&#93;&#91;x&#93;;
gotoxy(68,x);
}
cout&lt;&lt;arr[s1][x];
Sleep(1000); //요게 1초씩 대기함 ( 말그대로 sleep!!. 밀리세컨드 이기 때문에 1000이라 씀)
}
}
Sleep(1000); //요게 1초씩 대기함 ( 말그대로 sleep!!. 밀리세컨드 이기 때문에 1000이라 씀)
}
}
}}}
}



Revision as of 08:34, 28 August 2010

소스 파일

main.cpp

말그대로 메인입니다..

#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

시간을 표시합니다

/***********************************************************
* ////////현재시각표시//////////
*
* 아 진짜 고생 많이했다 ㅋㅋㅋㅋ
* 숫자 크기 정하느라 황금비율 찾아봤다능... ;;( 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이라 씀)
		}
}