//2016年c++课程设计
//Name: ATM存取模拟系统
//Author: Jiahui Tang
//Date: 2016-7
#include <stdlib.h>
#include <sstream>
#include <iostream>
#include <unistd.h>
#include <string>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Clock.H>
#include <FL/Fl_Progress.H>
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_Image.H>
using namespace std;
//---------------------------------------------------
//the global variable
bool user = false; //user is using or no user
string card_ID;
string card_password;
char money[100] = "200";
string text_in;
string text_out;
string text_in1;
string text_in2;
int money_in;
int money_out;
stringstream tmp1;
stringstream tmp3;
string tmp2;
int tmp_before;
int tmp_all;
int password_input_error; //when password input error,the variable +1,
//when the variable is 3, the ID locked.
string password_change1;
string password_change2; //if these two variables are same, change success.
/*
class SimpleWindow : public Fl_Window{
public:
SimpleWindow(int w, int h, const char* title );
~SimpleWindow();
Fl_Button* copy;
Fl_Button* quit;
Fl_Input* inp;
Fl_Output* out;
Fl_Text_Display* text;
Fl_Box* box;
Fl_Clock* clock;
// Fl_Button* button;
private:
static void cb_copy(Fl_Widget*, void*);
inline void cb_copy_i();
static void cb_quit(Fl_Widget*, void*);
inline void cb_quit_i();
};
*/
class GreenButton: public Fl_Button {
private:
friend Fl_Button;
int handle(int e) {
switch (e)
{
case FL_ENTER:
color(FL_GREEN);
labelsize(18);
redraw();
return 1;
case FL_LEAVE:
color(FL_GRAY);
labelsize(18);
redraw();
return 1;
default: return Fl_Button::handle(e);
}
}
public:
GreenButton(int x, int y, int w, int h, const char* l):Fl_Button(x, y, w, h, l) {}
};
class RedButton: public Fl_Button {
private:
friend Fl_Button;
int handle(int e) {
switch (e)
{
case FL_ENTER:
color(FL_RED);
labelsize(18);
redraw();
return 1;
case FL_LEAVE:
color(FL_GRAY);
labelsize(18);
redraw();
return 1;
default: return Fl_Button::handle(e);
}
}
public:
RedButton(int x, int y, int w, int h, const char* l):Fl_Button(x, y, w, h, l) {}
};
class BlueButton: public Fl_Button {
private:
friend Fl_Button;
int handle(int e) {
switch (e)
{
case FL_ENTER:
color(FL_BLUE);
labelsize(18);
redraw();
return 1;
case FL_LEAVE:
color(FL_GRAY);
labelsize(18);
redraw();
return 1;
default: return Fl_Button::handle(e);
}
}
public:
BlueButton(int x, int y, int w, int h, const char* l):Fl_Button(x, y, w, h, l) {}
};
class MagentaButton: public Fl_Button {
private:
friend Fl_Button;
int handle(int e) {
switch (e)
{
case FL_ENTER:
color(FL_MAGENTA);
labelsize(18);
redraw();
return 1;
case FL_LEAVE:
color(FL_GRAY);
labelsize(18);
redraw();
return 1;
default: return Fl_Button::handle(e);
}
}
public:
MagentaButton(int x, int y, int w, int h, const char* l):Fl_Button(x, y, w, h, l) {}
};
class CyanButton: public Fl_Button {
private:
friend Fl_Button;
int handle(int e) {
switch (e)
{
case FL_ENTER:
color(FL_CYAN);
labelsize(18);
redraw();
return 1;
case FL_LEAVE:
color(FL_GRAY);
labelsize(18);
redraw();
return 1;
default: return Fl_Button::handle(e);
}
}
public:
CyanButton(int x, int y, int w, int h, const char* l):Fl_Button(x, y, w, h, l) {}
};
class WhiteButton: public Fl_Button {
private:
friend Fl_Button;
int handle(int e) {
switch (e)
{
case FL_ENTER:
color(FL_WHITE);
labelsize(18);
redraw();
return 1;
case FL_LEAVE:
color(FL_GRAY);
labelsize(18);
redraw();
return 1;
default: return Fl_Button::handle(e);
}
}
public:
WhiteButton(int x, int y, int w, int h, const char* l):Fl_Button(x, y, w, h, l) {}
};
class Window_begin : public Fl_Window {
public:
Window_begin(int w, int h, const char* title);
~Window_begin();
Fl_Box* box1;
Fl_Box* box2;
Fl_Box* box3;
Fl_Box* box4;
Fl_Box* box5;
Fl_Box* box6;
Fl_Box* box7;
Fl_Box* box8;
Fl_Box* box9;
Fl_Box* box10;
Fl_Box* box11;
Fl_Output* out1;
Fl_Output* out2;
Fl_Output* out3;
Fl_Output* out4;
Fl_Input* inp1; //bank card ID
Fl_Input* inp2; //bank card password
Fl_Input* inp3; //withdraw money
Fl_Input* inp4; //deposit money
Fl_Input* inp5; //change password 1
Fl_Input* inp6; //change password 2
GreenButton* login; //the user login
GreenButton* exit; //the user exit
RedButton* withdraw; //withdraw money
MagentaButton* deposit; //deposit money
WhiteButton* query; //check the balance
CyanButton* change; //change the password
RedButton* button1; //withdraw 100
RedButton* button2; //withdraw 200
RedButton* button3; //withdraw 300
RedButton* button4; //withdraw 400
RedButton* button5; //withdraw 500
RedButton* button6; //withdraw 800
RedButton* button7; //withdraw 1000
RedButton* button8; //withdraw 1500
Fl_Clock* clock; //the clock
Fl_Progress* progress; //the progress
Fl_PNG_Image* image; //the image
private:
//the part of the user login and exit
static void cb_login(Fl_Widget*, void*);
inline void cb_login_i();
static void cb_exit(Fl_Widget*, void*);
inline void cb_exit_i();
//the part of withdraw money
static void cb_withdraw(Fl_Widget*, void*);
inline void cb_withdraw_i();
static void cb_100(Fl_Widget*, void*);
inline void cb_100_i();
static void cb_200(Fl_Widget*, void*);
inline void cb_200_i();
static void cb_300(Fl_Widget*, void*);
inline void cb_300_i();
static void cb_400(Fl_Widget*, void*);
inline void cb_400_i();
static void cb_500(Fl_Widget*, void*);
inline void cb_500_i();
static void cb_800(Fl_Widget*, void*);
inline void cb_800_i();
static void cb_1000(Fl_Widget*, void*);
inline void cb_1000_i();
static void cb_1500(Fl_Widget*, void*);
inline void cb_1500_i();
//the part of deposit money
static void cb_deposit(Fl_Widget*, void*);
inline void cb_deposit_i();
//the part of check the balance
static void cb_query(Fl_Widget*, void*);
inline void cb_query_i();
//the part of change password
static void cb_change(Fl_Widget*, void*);
inline void cb_change_i();
};
//----------------------------------------------------
int main (int argc, char **argv)
{
Window_begin begin(800,600,"ATM!!!");
return Fl::run();
//return 0;
//exit(0);
}
Window_begin::~Window_begin(){}
//----------------------------------------------------
/*
SimpleWindow::SimpleWindow(int w, int h, const char* title):Fl_Window(w,h,title)
{
begin();
copy = new Fl_Button( 10, 150, 70, 30, "C&opy");
copy->callback( cb_copy, this );
quit = new Fl_Button(100, 150, 70, 30, "&Quit");
quit->callback(cb_quit, this);
inp = new Fl_Input(50, 50, 140, 30, "Input:");
out = new Fl_Output(50, 100, 140, 30);
out->value("welcome!");
box = new Fl_Box(100,100,260,180,"Hello world");
box->labelsize(200);
box->labelfont(FL_BOLD+FL_ITALIC);
box->labeltype(FL_SHADOW_LABEL);
clock = new Fl_Clock(300,300,100,100);
Fl_Text_Buffer(text);
end();
resizable(this);
show();
}
*/
//begin window
Window_begin::Window_begin(int w, int h, const char* title):Fl_Window(w, h, title)
{
begin();
//const char* name = "image1.png";
//image->value = new Fl_PNG_Image(name, 100,100);
//image = new Fl_PNG_Image(100,100,"image1.png");
//Fl_PNG_Image("image1.png");
box10 = new Fl_Box(300,70,200,50,"Author: Jiahui Tang");
box11 = new Fl_Box(300,100,200,50," End of 2016-7");
box1 = new Fl_Box(300,200,200,50,"Welcome to use the ATM!!!");
//part of use

土豆片片
- 粉丝: 1890
最新资源
- 虚拟化技术从桌面到企业的全面解析
- 如何强化林业档案管理信息化在林业建设中的运用.docx
- 基于BeautifulSoup的网页表格数据定向抓取与CSV导出工具-网页表格解析与特定关键词数据提取-用于自动化采集网页表格中符合条件的数据并生成结构化CSV文件-bs4解析t.zip
- 影响与价值:试论互联网背景下小学心理教育的现实遵从.docx
- 人工智能在电子工程中的应用浅析.docx
- 猜灯谜网站项目规划书.doc
- 财政票据电子化下高校收费的大数据管理模式探讨.docx
- 关于计算机软件工程管理与应用探讨.docx
- 移动通信网络优化中大数据技术的运用分析.docx
- 铁路安防-急需综合网络视频监控-交通港口.docx
- 基于PLC的污水池里系统(开环)梯形图.doc
- 杨丽全国计算机二级C语言公共基础知识.ppt
- 论大数据时代的计算机网络安全及防范措施分析.docx
- P2P网络借贷平台发展、问题及应对办法.docx
- 电子科技16秋《电气控制及PLC》在线作业1-辅导资料.doc
- 家居设计方案中常用的CAD快捷键.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


