資源簡介
c++物流管理系統(tǒng),控制臺程序

代碼片段和文件信息
#include
using?namespace?std;
#include
#include
#include
#include“Admin.h“
struct?AdminInfo;
//構(gòu)造函數(shù),用戶注冊時調(diào)用自動生成用戶ID
Admin::Admin()
{
char?s2[7];
char?s1[6]?=?“Admin“;
int?usernum;
int?i?j;
//從文件userIDrecord.txt中讀取用戶ID后六位,將字符串
//轉(zhuǎn)化為數(shù)字后加一再轉(zhuǎn)化為字符串寫入文件中
//調(diào)用字符串轉(zhuǎn)換整型數(shù)庫函數(shù)?atoi
//調(diào)用整形數(shù)轉(zhuǎn)換字符串庫函數(shù)?itoa?
fstream?file(“userIDrecord.txt“?ios::in?|?ios::out);
if?(file.fail())
{
cout?<“open?file?userIDrecord?fail“;
exit(0);
}
file.getline(s2?7);
file.close();
strcat(s1?s2);
userID?=?new?char[strlen(s1)?+?1];
strcpy(userID?s1);
usernum?=?atoi(s2);
usernum?+=?1;
itoa(usernum?s2?10);
file.open(“userIDrecord.txt“?ios::out);
file?< file.close();
/*for?(j?=?0;?j<100;?j++)
{
for?(i?=?0;?i<19;?i++)
{
userOrder[j][i]?=?‘?‘;
}
userOrder[j][i]?=?‘\0‘;
}*/
}
//構(gòu)造函數(shù),用戶登錄時輸入用戶名或ID,從文件中查找用戶信息結(jié)構(gòu)體數(shù)據(jù)
//賦值于對象保護成員
Admin::Admin(char*?filename?char*?nameorID)
{
int?i;
AdminInfo?info;
fstream?file(filename?ios::in);
if?(file.fail())
{
cout?<“open?file?fall“;
exit(0);
}
while?(!file.eof())
{
userID?=?new?char[21];
file.getline(userID?21);
userName?=?new?char[21];
file.getline(userName?21);
userPassword?=?new?char[21];
file.getline(userPassword?21);
userAddress?=?new?char[21];
file.getline(userAddress?21);
userContact?=?new?char[21];
file.getline(userContact?21);
/*for?(i?=?0;?i<100;?i++)
{
file.getline(userOrder[i]?20);
}*/
if?(strcmp(userID?nameorID)?==?0?||?strcmp(userName?nameorID)?==?0)
{
break;
}
}
if?(file.eof()?==?1)
{
cout?<“未找到用戶數(shù)據(jù)“?< loadState?=?0;
}
else
{
//cout?<“用戶信息:“?< //this->showInfo();
loadState?=?1;
}
file.close();
}
//拷貝構(gòu)造函數(shù)
Admin::Admin(Admin?&obj)
{
int?j?i;
userID?=?new?char[strlen(obj.userID)?+?1];
strcpy(userID?obj.userID);
userName?=?new?char[strlen(obj.userName)?+?1];
strcpy(userName?obj.userName);
userPassword?=?new?char[strlen(obj.userPassword)?+?1];
strcpy(userPassword?obj.userPassword);
userContact?=?new?char[strlen(obj.userContact)?+?1];
strcpy(userContact?obj.userContact);
userAddress?=?new?char[strlen(obj.userAddress)?+?1];
strcpy(userAddress?obj.userAddress);
/*for?(j?=?0;?j<100;?j++)
{
for?(i?=?0;?i<20;?i++)
{
userOrder[j][i]?=?obj.userOrder[j][i];
}
}*/
}
//設(shè)置函數(shù)的定義
void?Admin::set_userID(char*?s)
{
userID?=?new?char[strlen(s)?+?1];
strcpy(userID?s);
}
void?Admin::set_userName(char?s[])
{
userName?=?new?char[strlen(s)?+?1];
strcpy(userName?s);
}
void?Admin::set_userPassword(char?*s)
{
userPassword?=?new?char[strlen(s)?+?1];
strcpy(userPassword?s);
}
void?Admin::set_userAddress(char*?s)
{
userAddress?=?new?char[strlen(s)?+?1];
strcpy(userAddress?s);
}
void?Admin::set_userContact(char*?s)
{
userContact?=?new?char[strlen(s)?+?1];
strcpy(userContact?s);
}
void?Admin::set_ord
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4441??2016-05-15?23:04??物流管理系統(tǒng)C++\Admin.cpp
?????文件???????1197??2016-05-15?22:47??物流管理系統(tǒng)C++\Admin.h
?????文件???????8231??2016-05-15?21:50??物流管理系統(tǒng)C++\cusService.cpp
?????文件????????834??2016-05-15?21:50??物流管理系統(tǒng)C++\cusService.h
?????文件???????1294??2016-05-15?21:50??物流管理系統(tǒng)C++\employee.cpp
?????文件????????826??2016-05-15?21:50??物流管理系統(tǒng)C++\employee.h
?????文件??????????8??2016-05-16?00:57??物流管理系統(tǒng)C++\employeeID.txt
?????文件????????200??2016-05-16?00:58??物流管理系統(tǒng)C++\employeeInfo.txt
?????文件???????5630??2016-05-15?21:56??物流管理系統(tǒng)C++\main.cpp
?????文件???????3102??2016-05-15?21:50??物流管理系統(tǒng)C++\order.cpp
?????文件???????1028??2016-05-15?21:50??物流管理系統(tǒng)C++\order.h
?????文件??????????8??2016-05-22?15:56??物流管理系統(tǒng)C++\orderID.txt
?????文件????????232??2016-05-22?15:57??物流管理系統(tǒng)C++\orderInfo.txt
?????文件??????????6??2016-05-22?15:58??物流管理系統(tǒng)C++\userIDrecord.txt
?????文件????????310??2016-05-22?15:33??物流管理系統(tǒng)C++\userInfoRecord.txt
?????文件?????732922??2016-05-16?01:47??物流管理系統(tǒng)C++\程序設(shè)計.docx
?????目錄??????????0??2016-05-31?01:56??物流管理系統(tǒng)C++
-----------?---------??----------?-----??----
???????????????760269????????????????????17
評論
共有 條評論