별별기능 다넣고보니까 960줄이에요ㅠㅠ?
그래도 다짜긴짰어요ㅠㅠ?
/***********************************************************************************/
/* Made By K.N (eu8198@hanmail.net) */
/*그레고리 개력 전, 즉 1582년 전은 달력이 조금 틀리다. 그부분까지 감안한 1.1v 달력.*/
/***********************************************************************************/
#include<iostream.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#define clrscr() system("cls")
int ty,tm,td;
time_t start,end,tim;
int saf;
int ey,ey1,em1,em,asad,asad1,iy1,im1,ed1,iy,im,ed;
int yoil[100][4][2];
int yo_il[13][7] = {
{1,2,3,4,5,6,7},
{1,2,3,4,5,6,7}, // 1월
{5,6,7,1,2,3,4}, // 2월
{5,6,7,1,2,3,4}, // 3월
{2,3,4,5,6,7,1}, // 4월
{7,1,2,3,4,5,6}, // 5월
{4,5,6,7,1,2,3}, // 6월
{2,3,4,5,6,7,1}, // 7월
{6,7,1,2,3,4,5}, // 8월
{3,4,5,6,7,1,2}, // 9월
{1,2,3,4,5,6,7}, // 10월
{5,6,7,1,2,3,4}, // 11월
{3,4,5,6,7,1,2}, // 12월
};
void dd(int a); //영어로 Monday Tuesday..등을 출력
void dda(int a); //한글로 월.화.수.. 등을 출력
int assa;
char buffer[255],buffer1[255];
int ass;
int wr = 0,diddma = -1,diddma1 = -1;
char cha;
int month_days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int year,month,a,b,ca;
int select;
int c = 0; // 달력빈공간
int ary,ay;//배열용 %100에 조건식 적용, 0~28 사이의 정수,천백자리%4
void chrlghk(); //초기화함수
void ym(int mee);// 몇월인지를 January..등으로 표시
int get_blank_up_1582(int year,int month);// 1582년 뒤의 달력
int get_blank_under_1582(int year,int month);// 1582년 전의 달력
int start11()
{
be:
int st;
system("cls");
cout << " ***************************"<<endl;
cout << " * Welcome To Calender1.1v!*"<<endl;
cout << " * Select your Language *"<<endl;
cout << " * 1.Korean *"<<endl;
cout << " * 2.Japanese *"<<endl;
cout << " * 3.English *"<<endl;
cout << " * 4.French *"<<endl;
cout << " ***************************"<<endl;
cout << " >> ";
cin >> select;
if(select == 1)
{
system("cls");
cout << " *******************************"<<endl;
cout << " *원하시는 모드를 선택해주세요 *"<<endl;
cout << " * 1. 달력보기 *"<<endl;
cout << " * 2. 기념일 등록 *"<<endl;
cout << " * 3. 공휴일 등록 *"<<endl;
cout << " * 4. 오늘 상세정보 *"<<endl;
cout << " * 5. 프로그램 정보 *"<<endl;
cout << " * 6. 전으로 돌아가기 *"<<endl;
cout << " * 7. 끝내기 *"<<endl;
cout << " *******************************"<<endl;
cout << " >> ";
cin >>st;
if(st == 7) exit(6);
else if(st == 6)goto be;
}
else if(select == 2 || select == 4)
{
system("cls");
cout << "Sorry, You cannot use this mode, for I didn't know that language. Sorry\nPress any key to continue"<<endl;
getch();
exit(1);
}
else if(select == 3)
{
system("cls");
system("cls");
cout << " *******************************"<<endl;
cout << " *Select mode that you want to *"<<endl;
cout << " * 1. See calender *"<<endl;
cout << " * 2. write memorial day *"<<endl;
cout << " * 3. write holiday *"<<endl;
cout << " * 4. About Today *"<<endl;
cout << " * 5. Information.. *"<<endl;
cout << " * 6. Go Back *"<<endl;
cout << " * 7. Exit *"<<endl;
cout << " *******************************"<<endl;
cout << " >> ";
cin >>st;
if(st == 7) exit(6);
else if(st == 6)goto be;
//영어로
}
else
{
system("cls");
cout << "A strange error has occured. Please try again. \nIf the error popups more than 10 times, ask eu8198@hanmail.net"<<endl;
getch();
exit(1);
}
system("cls");
return st;
}
void main()
{
a:
int sta;
sta = start11();
if(select == 3 && sta == 1){
c = 0; ca = 0; a = 0; b = 0; year = 0; month = 0; ary = 0; ay = 0;
cout << "Hi, This is ";
cout << "Calender Program \"v.1.1\""<<endl;
cout << "Input Year : ";
cin >> year;
if(year<0)
{
cout << " Warning ; A0001: Year? I can't open that!"<<endl;
exit(1);
}
cout<< "Input month : ";//월
cin >> month;
if(month<0 || month>13)
{
cout << " Warning ; A0002: Month? I can't open that!"<<endl;
exit(1);
}
chrlghk();
system("cls");
cout<<" "<<year << " Year ";
ym(month);
if(year%100 == 0)
{
if(year%400 == 0 || year%4 == 0)month_days[2] = 29;
else month_days[2] = 28;
}
else if(year%4 == 0)month_days[2]++;
cout << "Sun Mon Tue Wed Thu Fri Sat"<<endl;
if(year>=1582)
{
c = c+get_blank_up_1582(year,month);
saf = c;
if(c>=7)c%=7;
for(int i = 0;i< get_blank_up_1582(year,month);i++)
{
cout << " ";
}
if(c>=7){
c%=7;
cout << "\n";
}
}
else
{
c = c+get_blank_under_1582(year,month);
saf = c;
if(c>=7)c%=7;
for(int i = 0;i< get_blank_under_1582(year,month);i++)
{
cout << " ";
}
if(c>=7)
{
c%=7;
cout << "\n";
}
}
for(int i=1;i<=month_days[month];i++)
{
if(i<10)cout << " "; // 자릿수 맞추기
cout <<i<< " "; // 일정공간 띄우기
c++;
if(c%7==0)cout << "\n"; // 7로 나눠서 줄맞추기
}
cout << endl;
char buffer[255];
int ass;
FILE *re = fopen("C:\\holiday.in","r");
FILE *r = fopen("C:\\Donterase.in","r");
FILE *pe = fopen("C:\\holiday1.in","r");
FILE *p = fopen("C:\\Donterase1.in","r");
cout << endl;
cout <<"Holidays that inputed "<<year << " Year ";
ym(month);
fscanf(r,"%d\n",&ass);
int ey,em,asad,iy=0,im=0,ed = 0;
for(i=0;i<ass;i++)
{
ey = 0; em = 0; asad = 0; iy = 0; im = 0; ed = 0;
for(int i=0;i<255;i++)buffer[i] = -124;
fscanf(re,"%s\n",buffer);
fscanf(r,"%d %d %d %d\n",&diddma,&ey,&em,&ed);
if(year == ey && month == em){
if(diddma == 0)cout << " - (Solar)";
else if(diddma == 1)cout << " - (Lunar)";
else cout << "It might be bug.."<<endl;
cout <<buffer<< " : "<< ed<<" Day";
dd(ed);
//cout << endl;
}
}
cout << endl;
cout <<"Holidays that inputed ";
ym(month);
//int ey,em,asad,iy,im,ed;
fscanf(p,"%d\n",&assa);
for(i=0;i<assa;i++){
ey1 = 0; em1 = 0; ed1 = 0;
for(int i=0;i<255;i++)buffer1[i] = -124;
fscanf(pe,"%s\n",buffer1);
fscanf(p,"%d %d %d\n",&diddma1,&em1,&ed1);
if(month == em1 ){
if(diddma1 == 0)cout << " - (Solar)";
else if(diddma1 == 1)cout << " - (Lunar)";
else cout << "Bug.."<<endl;
cout << buffer1<< " : "<< ed1<<" Day";
dd(ed1);
fscanf(pe,"\n");
fscanf(p,"\n");
}
else
{
fscanf(pe,"\n");
fscanf(p,"\n");
}
}
cout << endl;
cout << endl;
int asd;
cout << "Press 1 to Go back and Press 2 to exit program[1/2] : ";
cin >> asd;
if(asd == 1)goto a;
else if(asd == 2)cout << "Thank you, press any key to continue.."<<endl;
else{
cout << "Input Error, Program stopped.. If the error causes again and again, send e-mail to eu8198@sayclub.com"<<endl;
}
getch();
}
else if(select == 1 && sta == 1){
c = 0; ca = 0; a = 0; b = 0; year = 0; month = 0; ary = 0; ay = 0;
cout << "안녕하세요, 달력 프로그램 1.1v 입니다."<<endl;
cout << endl;
cout << " 년도 : ";
cin >> year;
if(year<0)
{
cout << " Warning ; A0001: Year? I can't open that!"<<endl;
exit(1);
}
cout << " 달 : ";//월
cin >> month;
if(month<0 || month>13)
{
cout << " Warning ; A0002: Month? I can't open that!"<<endl;
exit(1);
}
chrlghk();
system("cls");
cout<<" "<<year << " 년 "<<month<<" 월 달력"<<endl;
if(year%100 == 0)
{
if(year%400 == 0 || year%4 == 0)month_days[2]++;
else {;}
}
else if(year%4 == 0)month_days[2]++;
cout << "일 월 화 수 목 금 토"<<endl;
if(year>=1582)
{
c = c+get_blank_up_1582(year,month);
saf = c;
if(c>=7)c%=7;
for(int i = 0;i< get_blank_up_1582(year,month);i++)
{
cout << " ";
}
if(c>=7){
c%=7;
cout << "\n";
}
}
else
{
c = c+get_blank_under_1582(year,month);
saf= c;
if(c>=7)c%=7;
for(int i = 0;i< get_blank_under_1582(year,month);i++)
{
cout << " ";
}
if(c>=7)
{
c%=7;
cout << "\n";
}
}
for(int i=1;i<=month_days[month];i++)
{
if(i<10)cout << " "; // 자릿수 맞추기
cout <<i<< " "; // 일정공간 띄우기
c++;
if(c%7==0)cout << "\n"; // 7로 나눠서 줄맞추기
}
cout << endl;
FILE *re = fopen("C:\\holiday.in","r");
FILE *r = fopen("C:\\Donterase.in","r");
FILE *pe = fopen("C:\\holiday1.in","r");
FILE *p = fopen("C:\\Donterase1.in","r");
cout << endl;
/* 기념일*/
cout <<year << " 년 "<<month<<" 월에 등록된 기념일"<<endl;
fscanf(r,"%d\n",&ass);
for(i=0;i<ass;i++)
{
for(int j=0;j<255;j++)buffer[j] = -124;
ey = 0; em = 0; asad = 0; iy = 0; im = 0; ed = 0;
fscanf(re,"%s\n",buffer);
fscanf(r,"%d %d %d %d\n",&diddma,&ey,&em,&ed);
if(year == ey && month == em)
{
if(diddma == 0)cout << " - (양력)";
else if(diddma == 1)cout << " - (음력)";
else cout << "버그.."<<endl;
cout << buffer<< " : "<< ed<<"일";
dda(ed);
}
}
cout << endl;
/*공휴일*/
cout << year << "년 "<<month<<"월에 등록된 공휴일"<<endl;
fscanf(p,"%d\n",&assa);
for(i=0;i<assa;i++)
{
ey1 = 0; em1 = 0; ed1 = 0;
for(int i=0;i<255;i++)buffer1[i] = -124;
fscanf(pe,"%s\n",buffer1);
fscanf(p,"%d %d %d\n",&diddma1,&em1,&ed1);
if(month == em1 ){
if(diddma1 == 0)cout << " - (양력)";
else if(diddma1 == 1)cout << " - (음력)";
else cout << "버그.."<<endl;
cout << buffer1<< " : " << ed1<<"일";
dda(ed1);
fscanf(pe,"\n");
fscanf(p,"\n");
}
else
{
fscanf(pe,"\n");
fscanf(p,"\n");
}
}
cout << endl;
int asd;
cout << "뒤로 가려면 1번, 끝내려면 2번을 누르세요 [1/2] : ";
cin >> asd;
if(asd == 1)goto a;
else if(asd == 2)cout << "감사합니다. 아무키나 누르십시오"<<endl;
else{
cout << "입력 에러. 계속 발생시 eu8198@sayclub.com로 신고 바람."<<endl;
}
getch();
}
else if(select == 1 && sta == 2)
{
int ye,mo,da;
char name[255];
FILE *in = fopen("c:\\holiday.in","a");
FILE *i2 = fopen("c:\\Donterase.in","a");
cout << " 경고; 비록 당신이 기념일을 성공적으로 등록했다고 해도, \n 당신은 프로그램을 다시 키지 않으면 방금 등록한 기념일을 볼수 없습니다."<<endl;
cout << "\n - 양력(0)입니까? 음력(1)입니까? : ";
cin >> diddma;
if(diddma!= 1 && diddma != 0)
{
cout << " 입력 에러. 계속 발생시 eu8198@sayclub.com로 신고 바람."<<endl;
exit(1);
}
cout << " - 기념일 년도는? : ";
cin >> ye;
cout << " - 기념일 달은? : ";
cin >> mo;
cout << " - 기념일 일자는? : ";
cin >> da;
cout << " - 기념일 이름은? : ";
cin >> name;
fprintf(i2,"%d ",diddma);
fprintf(in,"%s\n",name);
fprintf(i2,"%d %d %d\n",ye,mo,da);
cout << " 등록되었습니다!";
int asd;
cout << " 뒤로 가려면 1번, 끝내려면 2번을 누르세요 [1/2] : ";
cin >> asd;
if(asd == 1)goto a;
else if(asd == 2)cout << " 감사합니다. 아무키나 누르십시오"<<endl;
else{
cout << " 입력 에러. 계속 발생시 eu8198@sayclub.com로 신고 바람."<<endl;
}
getch();
}
/* 기념일 입력 */
else if(select == 3 && sta == 2)
{
int ye,mo,da;
char name[255];
FILE *in = fopen("C:\\Holiday.in","a");
FILE *i2 = fopen("c:\\Donterase.in","a");
cout << " Warning; Although you inputed Memorial day succesful, You cannot see it now..\n You can see it after turn this program again"<<endl;
cout << "\nSolar(0)? Lunar(1)? : ";
cin >> diddma;
if(diddma!= 1 && diddma != 0)
{
cout << " Input Error, Program stopped.. If the error causes again and again, send e-mail to eu8198@sayclub.com"<<endl;
exit(1);
}
cout << " - Memorial Day year? : ";
cin >> ye;
cout << " - Memorial Day month? : ";
cin >> mo;
cout << " - Memorial Day date? : ";
cin >> da;
cout << " - Memorial Day name? : ";
cin >> name;
fprintf(in,"%s\n",name);
fprintf(i2,"%d %d %d %d\n",diddma,ye,mo,da);
cout << " Input successful!";
int asd;
cout << " Press 1 to Go back and Press 2 to exit program[1/2] : ";
cin >> asd;
if(asd == 1)goto a;
else if(asd == 2)cout << " Thank you, press any key to continue.."<<endl;
else{
cout << " Input Error, Program stopped.. If the error causes again and again, send e-mail to eu8198@sayclub.com"<<endl;
}
getch();
}
/* 공휴일 입력*/
else if(select == 1 && sta == 3)
{
int mo,da;
char name[255];
FILE *in = fopen("c:\\holiday1.in","a");
FILE *i2 = fopen("c:\\Donterase1.in","a");
cout << " 경고; 비록 당신이 공휴일을 성공적으로 등록했다고 해도, \n 당신은 프로그램을 다시 키지 않으면 방금 등록한 공휴일을 볼수 없습니다."<<endl;
cout << "\n - 양력(0)입니까? 음력(1)입니까? : ";
cin >> diddma1;
if(diddma1!= 1 && diddma1 != 0)
{
cout << " 입력 에러. 계속 발생시 eu8198@sayclub.com로 신고 바람."<<endl;
exit(1);
}
cout << " - 공휴일의 달은? : ";
cin >> mo;
cout << " - 공휴일의 일자는? : ";
cin >> da;
cout << " - 공휴일 이름은? : ";
cin >> name;
fprintf(in,"%s\n",name);
fprintf(i2,"%d %d %d\n",diddma1,mo,da);
cout << " 등록되었습니다!";
int asd;
cout << " 뒤로 가려면 1번, 끝내려면 2번을 누르세요 [1/2] : ";
cin >> asd;
if(asd == 1)goto a;
else if(asd == 2)cout << " 감사합니다. 아무키나 누르십시오"<<endl;
else{
cout << " 입력 에러. 계속 발생시 eu8198@sayclub.com로 신고 바람."<<endl;
}
getch();
}
/* 공휴일 입력 */
else if(select == 3 && sta == 3)
{
int mo,da;
char name[255];
FILE *in = fopen("C:\\Holiday1.in","a");
FILE *i2 = fopen("c:\\Donterase1.in","a");
cout << " Warning; Although you inputed holiday succesful, You cannot see it now.. \n You can see it after turn this program again"<<endl;
cout << "\n - Solar(0)? Lunar(1)? : ";
cin >> diddma1;
if(diddma1!= 1 && diddma1 != 0)
{
cout << " Input Error, Program stopped.. If the error causes again and again, send e-mail to eu8198@sayclub.com"<<endl;
exit(1);
}
cout << " - Holiday month? : ";
cin >> mo;
cout << " - Holiday date? : ";
cin >> da;
cout << " - Holiday name? : ";
cin >> name;
fprintf(in,"%s\n",name);
fprintf(i2,"%d %d %d\n",diddma1,mo,da);
&nbs
그래도 다짜긴짰어요ㅠㅠ?
/***********************************************************************************/
/* Made By K.N (eu8198@hanmail.net) */
/*그레고리 개력 전, 즉 1582년 전은 달력이 조금 틀리다. 그부분까지 감안한 1.1v 달력.*/
/***********************************************************************************/
#include<iostream.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#define clrscr() system("cls")
int ty,tm,td;
time_t start,end,tim;
int saf;
int ey,ey1,em1,em,asad,asad1,iy1,im1,ed1,iy,im,ed;
int yoil[100][4][2];
int yo_il[13][7] = {
{1,2,3,4,5,6,7},
{1,2,3,4,5,6,7}, // 1월
{5,6,7,1,2,3,4}, // 2월
{5,6,7,1,2,3,4}, // 3월
{2,3,4,5,6,7,1}, // 4월
{7,1,2,3,4,5,6}, // 5월
{4,5,6,7,1,2,3}, // 6월
{2,3,4,5,6,7,1}, // 7월
{6,7,1,2,3,4,5}, // 8월
{3,4,5,6,7,1,2}, // 9월
{1,2,3,4,5,6,7}, // 10월
{5,6,7,1,2,3,4}, // 11월
{3,4,5,6,7,1,2}, // 12월
};
void dd(int a); //영어로 Monday Tuesday..등을 출력
void dda(int a); //한글로 월.화.수.. 등을 출력
int assa;
char buffer[255],buffer1[255];
int ass;
int wr = 0,diddma = -1,diddma1 = -1;
char cha;
int month_days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int year,month,a,b,ca;
int select;
int c = 0; // 달력빈공간
int ary,ay;//배열용 %100에 조건식 적용, 0~28 사이의 정수,천백자리%4
void chrlghk(); //초기화함수
void ym(int mee);// 몇월인지를 January..등으로 표시
int get_blank_up_1582(int year,int month);// 1582년 뒤의 달력
int get_blank_under_1582(int year,int month);// 1582년 전의 달력
int start11()
{
be:
int st;
system("cls");
cout << " ***************************"<<endl;
cout << " * Welcome To Calender1.1v!*"<<endl;
cout << " * Select your Language *"<<endl;
cout << " * 1.Korean *"<<endl;
cout << " * 2.Japanese *"<<endl;
cout << " * 3.English *"<<endl;
cout << " * 4.French *"<<endl;
cout << " ***************************"<<endl;
cout << " >> ";
cin >> select;
if(select == 1)
{
system("cls");
cout << " *******************************"<<endl;
cout << " *원하시는 모드를 선택해주세요 *"<<endl;
cout << " * 1. 달력보기 *"<<endl;
cout << " * 2. 기념일 등록 *"<<endl;
cout << " * 3. 공휴일 등록 *"<<endl;
cout << " * 4. 오늘 상세정보 *"<<endl;
cout << " * 5. 프로그램 정보 *"<<endl;
cout << " * 6. 전으로 돌아가기 *"<<endl;
cout << " * 7. 끝내기 *"<<endl;
cout << " *******************************"<<endl;
cout << " >> ";
cin >>st;
if(st == 7) exit(6);
else if(st == 6)goto be;
}
else if(select == 2 || select == 4)
{
system("cls");
cout << "Sorry, You cannot use this mode, for I didn't know that language. Sorry\nPress any key to continue"<<endl;
getch();
exit(1);
}
else if(select == 3)
{
system("cls");
system("cls");
cout << " *******************************"<<endl;
cout << " *Select mode that you want to *"<<endl;
cout << " * 1. See calender *"<<endl;
cout << " * 2. write memorial day *"<<endl;
cout << " * 3. write holiday *"<<endl;
cout << " * 4. About Today *"<<endl;
cout << " * 5. Information.. *"<<endl;
cout << " * 6. Go Back *"<<endl;
cout << " * 7. Exit *"<<endl;
cout << " *******************************"<<endl;
cout << " >> ";
cin >>st;
if(st == 7) exit(6);
else if(st == 6)goto be;
//영어로
}
else
{
system("cls");
cout << "A strange error has occured. Please try again. \nIf the error popups more than 10 times, ask eu8198@hanmail.net"<<endl;
getch();
exit(1);
}
system("cls");
return st;
}
void main()
{
a:
int sta;
sta = start11();
if(select == 3 && sta == 1){
c = 0; ca = 0; a = 0; b = 0; year = 0; month = 0; ary = 0; ay = 0;
cout << "Hi, This is ";
cout << "Calender Program \"v.1.1\""<<endl;
cout << "Input Year : ";
cin >> year;
if(year<0)
{
cout << " Warning ; A0001: Year? I can't open that!"<<endl;
exit(1);
}
cout<< "Input month : ";//월
cin >> month;
if(month<0 || month>13)
{
cout << " Warning ; A0002: Month? I can't open that!"<<endl;
exit(1);
}
chrlghk();
system("cls");
cout<<" "<<year << " Year ";
ym(month);
if(year%100 == 0)
{
if(year%400 == 0 || year%4 == 0)month_days[2] = 29;
else month_days[2] = 28;
}
else if(year%4 == 0)month_days[2]++;
cout << "Sun Mon Tue Wed Thu Fri Sat"<<endl;
if(year>=1582)
{
c = c+get_blank_up_1582(year,month);
saf = c;
if(c>=7)c%=7;
for(int i = 0;i< get_blank_up_1582(year,month);i++)
{
cout << " ";
}
if(c>=7){
c%=7;
cout << "\n";
}
}
else
{
c = c+get_blank_under_1582(year,month);
saf = c;
if(c>=7)c%=7;
for(int i = 0;i< get_blank_under_1582(year,month);i++)
{
cout << " ";
}
if(c>=7)
{
c%=7;
cout << "\n";
}
}
for(int i=1;i<=month_days[month];i++)
{
if(i<10)cout << " "; // 자릿수 맞추기
cout <<i<< " "; // 일정공간 띄우기
c++;
if(c%7==0)cout << "\n"; // 7로 나눠서 줄맞추기
}
cout << endl;
char buffer[255];
int ass;
FILE *re = fopen("C:\\holiday.in","r");
FILE *r = fopen("C:\\Donterase.in","r");
FILE *pe = fopen("C:\\holiday1.in","r");
FILE *p = fopen("C:\\Donterase1.in","r");
cout << endl;
cout <<"Holidays that inputed "<<year << " Year ";
ym(month);
fscanf(r,"%d\n",&ass);
int ey,em,asad,iy=0,im=0,ed = 0;
for(i=0;i<ass;i++)
{
ey = 0; em = 0; asad = 0; iy = 0; im = 0; ed = 0;
for(int i=0;i<255;i++)buffer[i] = -124;
fscanf(re,"%s\n",buffer);
fscanf(r,"%d %d %d %d\n",&diddma,&ey,&em,&ed);
if(year == ey && month == em){
if(diddma == 0)cout << " - (Solar)";
else if(diddma == 1)cout << " - (Lunar)";
else cout << "It might be bug.."<<endl;
cout <<buffer<< " : "<< ed<<" Day";
dd(ed);
//cout << endl;
}
}
cout << endl;
cout <<"Holidays that inputed ";
ym(month);
//int ey,em,asad,iy,im,ed;
fscanf(p,"%d\n",&assa);
for(i=0;i<assa;i++){
ey1 = 0; em1 = 0; ed1 = 0;
for(int i=0;i<255;i++)buffer1[i] = -124;
fscanf(pe,"%s\n",buffer1);
fscanf(p,"%d %d %d\n",&diddma1,&em1,&ed1);
if(month == em1 ){
if(diddma1 == 0)cout << " - (Solar)";
else if(diddma1 == 1)cout << " - (Lunar)";
else cout << "Bug.."<<endl;
cout << buffer1<< " : "<< ed1<<" Day";
dd(ed1);
fscanf(pe,"\n");
fscanf(p,"\n");
}
else
{
fscanf(pe,"\n");
fscanf(p,"\n");
}
}
cout << endl;
cout << endl;
int asd;
cout << "Press 1 to Go back and Press 2 to exit program[1/2] : ";
cin >> asd;
if(asd == 1)goto a;
else if(asd == 2)cout << "Thank you, press any key to continue.."<<endl;
else{
cout << "Input Error, Program stopped.. If the error causes again and again, send e-mail to eu8198@sayclub.com"<<endl;
}
getch();
}
else if(select == 1 && sta == 1){
c = 0; ca = 0; a = 0; b = 0; year = 0; month = 0; ary = 0; ay = 0;
cout << "안녕하세요, 달력 프로그램 1.1v 입니다."<<endl;
cout << endl;
cout << " 년도 : ";
cin >> year;
if(year<0)
{
cout << " Warning ; A0001: Year? I can't open that!"<<endl;
exit(1);
}
cout << " 달 : ";//월
cin >> month;
if(month<0 || month>13)
{
cout << " Warning ; A0002: Month? I can't open that!"<<endl;
exit(1);
}
chrlghk();
system("cls");
cout<<" "<<year << " 년 "<<month<<" 월 달력"<<endl;
if(year%100 == 0)
{
if(year%400 == 0 || year%4 == 0)month_days[2]++;
else {;}
}
else if(year%4 == 0)month_days[2]++;
cout << "일 월 화 수 목 금 토"<<endl;
if(year>=1582)
{
c = c+get_blank_up_1582(year,month);
saf = c;
if(c>=7)c%=7;
for(int i = 0;i< get_blank_up_1582(year,month);i++)
{
cout << " ";
}
if(c>=7){
c%=7;
cout << "\n";
}
}
else
{
c = c+get_blank_under_1582(year,month);
saf= c;
if(c>=7)c%=7;
for(int i = 0;i< get_blank_under_1582(year,month);i++)
{
cout << " ";
}
if(c>=7)
{
c%=7;
cout << "\n";
}
}
for(int i=1;i<=month_days[month];i++)
{
if(i<10)cout << " "; // 자릿수 맞추기
cout <<i<< " "; // 일정공간 띄우기
c++;
if(c%7==0)cout << "\n"; // 7로 나눠서 줄맞추기
}
cout << endl;
FILE *re = fopen("C:\\holiday.in","r");
FILE *r = fopen("C:\\Donterase.in","r");
FILE *pe = fopen("C:\\holiday1.in","r");
FILE *p = fopen("C:\\Donterase1.in","r");
cout << endl;
/* 기념일*/
cout <<year << " 년 "<<month<<" 월에 등록된 기념일"<<endl;
fscanf(r,"%d\n",&ass);
for(i=0;i<ass;i++)
{
for(int j=0;j<255;j++)buffer[j] = -124;
ey = 0; em = 0; asad = 0; iy = 0; im = 0; ed = 0;
fscanf(re,"%s\n",buffer);
fscanf(r,"%d %d %d %d\n",&diddma,&ey,&em,&ed);
if(year == ey && month == em)
{
if(diddma == 0)cout << " - (양력)";
else if(diddma == 1)cout << " - (음력)";
else cout << "버그.."<<endl;
cout << buffer<< " : "<< ed<<"일";
dda(ed);
}
}
cout << endl;
/*공휴일*/
cout << year << "년 "<<month<<"월에 등록된 공휴일"<<endl;
fscanf(p,"%d\n",&assa);
for(i=0;i<assa;i++)
{
ey1 = 0; em1 = 0; ed1 = 0;
for(int i=0;i<255;i++)buffer1[i] = -124;
fscanf(pe,"%s\n",buffer1);
fscanf(p,"%d %d %d\n",&diddma1,&em1,&ed1);
if(month == em1 ){
if(diddma1 == 0)cout << " - (양력)";
else if(diddma1 == 1)cout << " - (음력)";
else cout << "버그.."<<endl;
cout << buffer1<< " : " << ed1<<"일";
dda(ed1);
fscanf(pe,"\n");
fscanf(p,"\n");
}
else
{
fscanf(pe,"\n");
fscanf(p,"\n");
}
}
cout << endl;
int asd;
cout << "뒤로 가려면 1번, 끝내려면 2번을 누르세요 [1/2] : ";
cin >> asd;
if(asd == 1)goto a;
else if(asd == 2)cout << "감사합니다. 아무키나 누르십시오"<<endl;
else{
cout << "입력 에러. 계속 발생시 eu8198@sayclub.com로 신고 바람."<<endl;
}
getch();
}
else if(select == 1 && sta == 2)
{
int ye,mo,da;
char name[255];
FILE *in = fopen("c:\\holiday.in","a");
FILE *i2 = fopen("c:\\Donterase.in","a");
cout << " 경고; 비록 당신이 기념일을 성공적으로 등록했다고 해도, \n 당신은 프로그램을 다시 키지 않으면 방금 등록한 기념일을 볼수 없습니다."<<endl;
cout << "\n - 양력(0)입니까? 음력(1)입니까? : ";
cin >> diddma;
if(diddma!= 1 && diddma != 0)
{
cout << " 입력 에러. 계속 발생시 eu8198@sayclub.com로 신고 바람."<<endl;
exit(1);
}
cout << " - 기념일 년도는? : ";
cin >> ye;
cout << " - 기념일 달은? : ";
cin >> mo;
cout << " - 기념일 일자는? : ";
cin >> da;
cout << " - 기념일 이름은? : ";
cin >> name;
fprintf(i2,"%d ",diddma);
fprintf(in,"%s\n",name);
fprintf(i2,"%d %d %d\n",ye,mo,da);
cout << " 등록되었습니다!";
int asd;
cout << " 뒤로 가려면 1번, 끝내려면 2번을 누르세요 [1/2] : ";
cin >> asd;
if(asd == 1)goto a;
else if(asd == 2)cout << " 감사합니다. 아무키나 누르십시오"<<endl;
else{
cout << " 입력 에러. 계속 발생시 eu8198@sayclub.com로 신고 바람."<<endl;
}
getch();
}
/* 기념일 입력 */
else if(select == 3 && sta == 2)
{
int ye,mo,da;
char name[255];
FILE *in = fopen("C:\\Holiday.in","a");
FILE *i2 = fopen("c:\\Donterase.in","a");
cout << " Warning; Although you inputed Memorial day succesful, You cannot see it now..\n You can see it after turn this program again"<<endl;
cout << "\nSolar(0)? Lunar(1)? : ";
cin >> diddma;
if(diddma!= 1 && diddma != 0)
{
cout << " Input Error, Program stopped.. If the error causes again and again, send e-mail to eu8198@sayclub.com"<<endl;
exit(1);
}
cout << " - Memorial Day year? : ";
cin >> ye;
cout << " - Memorial Day month? : ";
cin >> mo;
cout << " - Memorial Day date? : ";
cin >> da;
cout << " - Memorial Day name? : ";
cin >> name;
fprintf(in,"%s\n",name);
fprintf(i2,"%d %d %d %d\n",diddma,ye,mo,da);
cout << " Input successful!";
int asd;
cout << " Press 1 to Go back and Press 2 to exit program[1/2] : ";
cin >> asd;
if(asd == 1)goto a;
else if(asd == 2)cout << " Thank you, press any key to continue.."<<endl;
else{
cout << " Input Error, Program stopped.. If the error causes again and again, send e-mail to eu8198@sayclub.com"<<endl;
}
getch();
}
/* 공휴일 입력*/
else if(select == 1 && sta == 3)
{
int mo,da;
char name[255];
FILE *in = fopen("c:\\holiday1.in","a");
FILE *i2 = fopen("c:\\Donterase1.in","a");
cout << " 경고; 비록 당신이 공휴일을 성공적으로 등록했다고 해도, \n 당신은 프로그램을 다시 키지 않으면 방금 등록한 공휴일을 볼수 없습니다."<<endl;
cout << "\n - 양력(0)입니까? 음력(1)입니까? : ";
cin >> diddma1;
if(diddma1!= 1 && diddma1 != 0)
{
cout << " 입력 에러. 계속 발생시 eu8198@sayclub.com로 신고 바람."<<endl;
exit(1);
}
cout << " - 공휴일의 달은? : ";
cin >> mo;
cout << " - 공휴일의 일자는? : ";
cin >> da;
cout << " - 공휴일 이름은? : ";
cin >> name;
fprintf(in,"%s\n",name);
fprintf(i2,"%d %d %d\n",diddma1,mo,da);
cout << " 등록되었습니다!";
int asd;
cout << " 뒤로 가려면 1번, 끝내려면 2번을 누르세요 [1/2] : ";
cin >> asd;
if(asd == 1)goto a;
else if(asd == 2)cout << " 감사합니다. 아무키나 누르십시오"<<endl;
else{
cout << " 입력 에러. 계속 발생시 eu8198@sayclub.com로 신고 바람."<<endl;
}
getch();
}
/* 공휴일 입력 */
else if(select == 3 && sta == 3)
{
int mo,da;
char name[255];
FILE *in = fopen("C:\\Holiday1.in","a");
FILE *i2 = fopen("c:\\Donterase1.in","a");
cout << " Warning; Although you inputed holiday succesful, You cannot see it now.. \n You can see it after turn this program again"<<endl;
cout << "\n - Solar(0)? Lunar(1)? : ";
cin >> diddma1;
if(diddma1!= 1 && diddma1 != 0)
{
cout << " Input Error, Program stopped.. If the error causes again and again, send e-mail to eu8198@sayclub.com"<<endl;
exit(1);
}
cout << " - Holiday month? : ";
cin >> mo;
cout << " - Holiday date? : ";
cin >> da;
cout << " - Holiday name? : ";
cin >> name;
fprintf(in,"%s\n",name);
fprintf(i2,"%d %d %d\n",diddma1,mo,da);
&nbs
댓글 달기 WYSIWYG 사용