Created
November 6, 2012 15:58
-
-
Save Jack2/4025640 to your computer and use it in GitHub Desktop.
[C++]hw4_CUI_calc_2012/11/07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
#include <termios.h> | |
#include <unistd.h> | |
using namespace std; | |
int getch(void) | |
{ | |
int ch; | |
struct termios buf; | |
struct termios save; | |
tcgetattr(0, &save); | |
buf = save; | |
buf.c_lflag &= ~(ICANON|ECHO); | |
buf.c_cc[VMIN] = 1; | |
buf.c_cc[VTIME] = 0; | |
tcsetattr(0, TCSAFLUSH, &buf); | |
ch = getchar(); | |
tcsetattr(0, TCSAFLUSH, &save); | |
return ch; | |
} | |
class Kkupdaeki | |
{ | |
public: | |
void DrawTriangle(); | |
}; | |
class Kyesan | |
{ | |
public: | |
int outnum; | |
void input(); | |
int calc(int num1, int num2, char buho){ | |
return outnum; | |
} | |
void output(); | |
}; | |
//입력값을 보여주는 창 | |
void Kyesan::input(){ | |
cout << "\n\n\t\t = Jack2 Calc = \n"; | |
cout << "\t -------------------------------------\n"; | |
cout << "\t| |\n"; | |
cout << "\t| --------------------------------- |\n"; | |
//int innum; | |
//cout << "\t\t\t\t\t"; | |
//cin >> innum; | |
} | |
//계산결과값을 보여주는 창 | |
void Kyesan::output(){ | |
int outnum; | |
cout << "result\n"; | |
} | |
// 전체적인 계산기 모형을 그려주는 함수 | |
void Kkupdaeki::DrawTriangle(){ | |
Kyesan kyesan; | |
cout << "\t| --- --- --- --- |\n"; | |
cout << "\t| | 7 | | 8 | | 9 | |Cls| |\n"; | |
cout << "\t| --- --- --- --- |\n"; | |
cout << "\t| --- --- --- --- |\n"; | |
cout << "\t| | 4 | | 5 | | 6 | | = | |\n"; | |
cout << "\t| --- --- --- --- |\n"; | |
cout << "\t| --- --- --- --- |\n"; | |
cout << "\t| | 1 | | 2 | | 3 | | * | |\n"; | |
cout << "\t| --- --- --- --- |\n"; | |
cout << "\t| --- --- --- --- |\n"; | |
cout << "\t| | 0 | | . | | + | | - | |\n"; | |
cout << "\t| --- --- --- --- |\n"; | |
cout << "\t -------------------------------------\n"; | |
} | |
//Key 입력값을 확인하기 위한 Test Class | |
class Key { | |
public : | |
void Test(); | |
int UpNum; | |
int DownNum; | |
int RightNum; | |
int LeftNum; | |
}; | |
void Key::Test(){ | |
int InputNum; | |
cout << "입력한 키보드의 숫자는 => "; | |
InputNum = getch(); | |
cout << InputNum << endl; | |
} | |
int main() | |
{ | |
int soo; | |
Kkupdaeki nemo; | |
Kyesan writing; | |
Key key; | |
do{ | |
key.Test(); | |
// writing.input(); | |
// nemo.DrawTriangle(); | |
}while(getch()!='q'); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment