資源簡介
電子商務系統
簡要介紹
北郵 大三上學期 C++ 課程設計(2)
C++課程設計作業。實現了超市購物和銀行存取款兩個部分。主要使用C++完成,基于Qt的圖形化界面,使用SQLite作為數據庫,涉及了基本的 select 、 delete 等語法。兩個程序(Store和Bank)之間通過Socket通信,使用TCP協議。
數據結構
設計了銀行賬戶類account,以及具有繼承關系的商品類product以及它的子類們書籍類 book、食品類 food等等。
數據庫
為賬戶信息、商品信息和購物車設置了表 accountInfo、productInfo 和 cart。通過商品id將 productInfo 和 accountInfo相關聯,通過賬戶名將 accountInfo 和 cart 關聯起來。
Socket通信
使用了 Qt 內置的類 QtTcpSocket ,通過在銀行設置 QTcpServer 作為服務器端,在商店設置 QTcpSocket 作為客戶端,當用戶購買物品結算時,商店向銀行發出請求進行驗證,驗證成功則銀行扣款,商店確認訂單。

代碼片段和文件信息
#include?“account.h“
QString?account::getNum(){
????return?this->num;
}
void?account::setNum(QString?num){
????this->num=num;
}
QString?account::getPassword(){
????return?this->password;
}
void?account::setPassword(QString?password){
????this->password=password;
}
QString?account::getBank(){
????return?this->bank;
}
void?account::setBank(QString?bank){
????this->bank=bank;
}
void?account::setId(QString?id){
????this->id=id;
}
QString?account::getId(){
????return?this->id;
}
QString?account::getContact(){
????return?this->contact;
}
void?account::setContact(QString?contact){
????this->contact=contact;
}
float?account::getBalance(){
????return?this->balance;
}
void?account::setBalance(float?balance){
????this->balance=balance;
}
void?account::addBalance(float?add){
????this->balance+=add;
}
bool?account::subBalance(float?sub){
????if(this->balance????????return?false;
????else{
????????this->balance-=sub;
????????return?true;
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-01-09?01:31??Store\
?????文件????????4038??2017-12-04?21:11??Store\addcartdialog.cpp
?????文件?????????477??2017-12-04?21:11??Store\addcartdialog.h
?????文件????????9545??2017-12-04?21:11??Store\addcartdialog.ui
?????文件?????????184??2017-12-04?21:11??Store\book.cpp
?????文件?????????437??2017-12-04?21:11??Store\book.h
?????文件????????6828??2017-12-04?21:11??Store\cartdialog.cpp
?????文件?????????610??2017-12-04?21:11??Store\cartdialog.h
?????文件????????7187??2017-12-04?21:11??Store\cartdialog.ui
?????文件????????2548??2017-12-04?21:11??Store\carteditdialog.cpp
?????文件?????????496??2017-12-04?21:11??Store\carteditdialog.h
?????文件????????8939??2017-12-04?21:11??Store\carteditdialog.ui
?????文件?????????186??2017-12-04?21:11??Store\cloth.cpp
?????文件?????????585??2017-12-04?21:11??Store\cloth.h
?????文件????????4079??2017-12-04?21:11??Store\configdialog.cpp
?????文件?????????499??2017-12-04?21:11??Store\configdialog.h
?????文件????????8521??2017-12-04?21:11??Store\configdialog.ui
?????文件????????4296??2017-12-04?21:11??Store\databa
?????文件?????????431??2017-12-04?21:11??Store\datastruct.h
?????文件?????????230??2017-12-04?21:11??Store\defineres.h
?????文件?????????194??2017-12-04?21:11??Store\electro.cpp
?????文件?????????619??2017-12-04?21:11??Store\electro.h
?????文件?????????182??2017-12-04?21:11??Store\food.cpp
?????文件?????????593??2017-12-04?21:11??Store\food.h
?????目錄???????????0??2018-01-09?01:31??Store\Icon\
?????文件???????16067??2017-12-04?21:11??Store\Icon\addcart-white-48.png
?????文件???????16045??2017-12-04?21:11??Store\Icon\book-32.png
?????文件???????15890??2017-12-04?21:11??Store\Icon\cart-white-48.png
?????文件???????15853??2017-12-04?21:11??Store\Icon\cloth-32.png
?????文件???????16344??2017-12-04?21:11??Store\Icon\config-white-48.png
?????文件???????15659??2017-12-04?21:11??Store\Icon\electro-32.png
............此處省略72個文件信息
- 上一篇:用openglMFC實現的魔方
- 下一篇:如何用VC++創建及調用DLL
評論
共有 條評論