Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<ctime>
- #include<string.h>
- #include<stdlib.h>
- #include<conio.h>
- #include<windows.h>
- #include<fstream>
- using namespace std; //std이란 네임스페이스를 사용.
- void Nation_list(void);
- void Korea(void);
- void search(char input[]);
- class Nation //'국가' 클래스화
- {
- public :
- char Name[10]; //국가 이름
- char Capital[10];//수도
- char Language[20];
- char President[20];//국가 원수 이름
- long Population; //인구
- char GDP[10]; //GDP
- };//메인함수의 인터페이스
- int main(void) //메인출력
- {
- char input[10];
- Nation_list();
- cout<<"선택 : ";
- cin>>input;
- search(input);
- return 0;
- }
- void gotoxy(int x, int y) //커서자표값 지정
- {
- COORD pos; //커서 자표값을 지정해주는 구조채
- pos.X = x;
- pos.Y = y;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
- }
- void numfnd(int num, int x, int y) //7-segment 설정
- {
- switch(num)
- {
- case 0 : gotoxy(x,y+0); cout<<"■■■■■"<<endl;
- gotoxy(x,y+1); cout<<"■ ■"<<endl;
- gotoxy(x,y+2); cout<<"■ ■"<<endl;
- gotoxy(x,y+3); cout<<"■ ■"<<endl;
- gotoxy(x,y+4); cout<<"■■■■■"<<endl; break;
- case 1 : gotoxy(x,y+0); cout<<" ■"<<endl;
- gotoxy(x,y+1); cout<<" ■"<<endl;
- gotoxy(x,y+2); cout<<" ■"<<endl;
- gotoxy(x,y+3); cout<<" ■"<<endl;
- gotoxy(x,y+4); cout<<" ■"<<endl; break;
- case 2 : gotoxy(x,y+0); cout<<"■■■■■"<<endl;
- gotoxy(x,y+1); cout<<" ■"<<endl;
- gotoxy(x,y+2); cout<<"■■■■■"<<endl;
- gotoxy(x,y+3); cout<<"■ "<<endl;
- gotoxy(x,y+4); cout<<"■■■■■"<<endl; break;
- case 3 : gotoxy(x,y+0); cout<<"■■■■■"<<endl;
- gotoxy(x,y+1); cout<<" ■"<<endl;
- gotoxy(x,y+2); cout<<"■■■■■"<<endl;
- gotoxy(x,y+3); cout<<" ■"<<endl;
- gotoxy(x,y+4); cout<<"■■■■■"<<endl; break;
- case 4 : gotoxy(x,y+0); cout<<"■ ■"<<endl;
- gotoxy(x,y+1); cout<<"■ ■"<<endl;
- gotoxy(x,y+2); cout<<"■■■■■"<<endl;
- gotoxy(x,y+3); cout<<" ■"<<endl;
- gotoxy(x,y+4); cout<<" ■"<<endl; break;
- case 5 : gotoxy(x,y+0); cout<<"■■■■■"<<endl;
- gotoxy(x,y+1); cout<<"■ "<<endl;
- gotoxy(x,y+2); cout<<"■■■■■"<<endl;
- gotoxy(x,y+3); cout<<" ■"<<endl;
- gotoxy(x,y+4); cout<<"■■■■■"<<endl; break;
- case 6 : gotoxy(x,y+0); cout<<"■■■■■"<<endl;
- gotoxy(x,y+1); cout<<"■ "<<endl;
- gotoxy(x,y+2); cout<<"■■■■■"<<endl;
- gotoxy(x,y+3); cout<<"■ ■"<<endl;
- gotoxy(x,y+4); cout<<"■■■■■"<<endl; break;
- case 7 : gotoxy(x,y+0); cout<<"■■■■■"<<endl;
- gotoxy(x,y+1); cout<<" ■"<<endl;
- gotoxy(x,y+2); cout<<" ■"<<endl;
- gotoxy(x,y+3); cout<<" ■"<<endl;
- gotoxy(x,y+4); cout<<" ■"<<endl; break;
- case 8 : gotoxy(x,y+0); cout<<"■■■■■"<<endl;
- gotoxy(x,y+1); cout<<"■ ■"<<endl;
- gotoxy(x,y+2); cout<<"■■■■■"<<endl;
- gotoxy(x,y+3); cout<<"■ ■"<<endl;
- gotoxy(x,y+4); cout<<"■■■■■"<<endl; break;
- case 9 : gotoxy(x,y+0); cout<<"■■■■■"<<endl;
- gotoxy(x,y+1); cout<<"■ ■"<<endl;
- gotoxy(x,y+2); cout<<"■■■■■"<<endl;
- gotoxy(x,y+3); cout<<" ■"<<endl;
- gotoxy(x,y+4); cout<<"■■■■■"<<endl; break;
- case 10 : gotoxy(x,y+0); cout<<" "<<endl;
- gotoxy(x,y+1); cout<<" ■ "<<endl;
- gotoxy(x,y+2); cout<<" "<<endl;
- gotoxy(x,y+3); cout<<" ■ "<<endl;
- gotoxy(x,y+4); cout<<" "<<endl; break;
- default : gotoxy(x,y+0); cout<<" ■■■ "<<endl;
- gotoxy(x,y+1); cout<<"■ ■"<<endl;
- gotoxy(x,y+2); cout<<" ■ "<<endl;
- gotoxy(x,y+3); cout<<" ■ "<<endl;
- gotoxy(x,y+4); cout<<" ■ "<<endl;break;
- }
- }
- void TimeZone(char *city, int plustime) //7-segment 시계출력부분
- {
- int timenow = time(0);
- int tmp = timenow / 86400;
- int s = timenow%60;
- int m = (timenow/60)-(timenow/3600*60);
- int h = ((timenow/3600)-(tmp*24))+plustime;
- //int bh = ((timenow+plustime)/3600)-(tmp*24);
- if(h>=24) h-=24;
- else if(h<0) h+=24;
- numfnd(h/10,2,10);
- numfnd(h%10,15,10);
- numfnd(10,28,10);
- numfnd(m/10,41,10);
- numfnd(m%10,54,10);
- numfnd(10,67,10);
- numfnd(s/10,80,10);
- numfnd(s%10,93,10);
- Sleep(500);
- }
- void search(char input[]) //나라검색
- {
- if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else if(strcmp(input,"대한민국")==0) Korea();
- else Korea();
- }
- void Nation_list(void) //메인화면출력부분
- {
- cout<<" ,:;;~, . "<<endl;
- cout<<" ~;;;::::~~~~~, - - "<<endl;
- cout<<" ;!;:~;~~~,-~~~~~~. -- --- ,;!!!;- ~;;;;;;;;;; .~!!!!;- ;;;;;;:-. "<<endl;
- cout<<" !!!:--,,..~~~ ,.: ---, .--- !!!. .!!! ~! .!!;. -!!; !! .:!!; "<<endl;
- cout<<" :--~--,,,..~---~ ,,, --- .--- .;! !!. ~! !!; !! -!!, "<<endl;
- cout<<" ;!~~--,,,-,,~~-~ .~:: --: -; !! !! ~! !! !! ,!! "<<endl;
- cout<<" ~:~:-!-;.;~~~~~~~ ~-:: !: ;; !! !! ~!;;;;;;;; .!! !! !! "<<endl;
- cout<<" !;~-;;;:-,--~~:~~~:,,: :!;: ;;! :!- -!; ~! !!. !! !!; "<<endl;
- cout<<" !~!!!;;;,--~::::::,, ;!!! !!! ;!; !!; ~! !!: :, !! .!!; "<<endl;
- cout<<" !!;!;!;;;:;;:;;;;~ ,!!: !!! ;!!!!!!!~ ~!!!!!!!!!! .!!!!!!!!; !!!!!!!!! "<<endl;
- cout<<" .!;;;!!;;;;;;;! ,! !! "<<endl;
- cout<<" ,!;;;!;!!, , ! "<<endl;
- cout<<"그리스 "<<" 네덜란드 "<<" 노르웨이"<<endl;
- cout<<"뉴질랜드 "<<" 대한민국 "<<" 덴마크"<<endl;
- cout<<"독일 "<<" 라트비아 "<<" 룩셈부르크"<<endl;
- cout<<"멕시코 "<<" 미국 "<<" 벨기에"<<endl;
- cout<<"스웨덴 "<<" 스위스 "<<" 스페인"<<endl;
- cout<<"슬로바키아"<<" 슬로베니아"<<" 아이슬란드"<<endl;
- cout<<"아일랜드 "<<" 에스토니아"<<" 영국"<<endl;
- cout<<"오스트리아"<<" 이스라엘 "<<" 이탈리아"<<endl;
- cout<<"일본 "<<" 체코 "<<" 칠레"<<endl;
- cout<<"캐나다 "<<" 터키 "<<" 포르투갈"<<endl;
- cout<<"폴란드 "<<" 프랑스 "<<" 필란드"<<endl;
- cout<<"헝가리 "<<" 호주 "<<endl;
- }
- void Korea(void) //Korea출력부분
- {
- //Nation Korea = {"대한민국","서울","한국어","문재인",51753820,"1조4981억"}; //인터페이스를 참고하여 한국의 대한 데이터
- string file="korea.txt";
- while(1)
- {
- system("cls");
- ifstream open(file.data());
- if(open.is_open()){
- string line;
- while(getline(open,line)){
- cout<<line<<endl;
- }
- cout<<"대한민국시간"<<endl;
- open.close();
- }
- TimeZone("대한민국",9);
- Sleep(500);
- if(kbhit()==1) break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement