求助各位好心人,能不能帮忙设计个C++程序,谢谢啦

题目名称:销售员业绩管理类的设计
内容及要求:
设计一个销售员业绩管理类,类中包含数据为:编号、姓名、销售产品名、产品单价、销售数量、销售额。其中销售额通过计算得到,计算公式:销售额=产品单价*销售数量
成员函数有:设置或修改数据功能、显示功能、获取数据功能等。
主函数设计对象数组,可以实现以下功能:
(1)输入:输入数据 (2)显示:显示所有记录 (3)查询:输入姓名,显示该销售员的销售记录,并计算销售总额。(4)删除:能删除指定的记录
数据保存到磁盘文件中,能显示文件的全部内容。使用菜单实现选择功能。

看了你的需求,我觉得你这个可以分两个大方面:数据处理和界面显示,
1.数据处理分两个类:第一个类是数据类,第二哥是数据管理类。
第一个数据类:它的功能就是存储销售员数据记录,里面有下面内容:
SetNum();GetNum();设置得到编号
SetName();GetName();设置得到姓名
AddProjectInfo(Name,price,Count);SetProjectInfo(Name,price,Count);Delete(Name);
增加,修改,删除产品名,单价,数量。
GetSaleVolume();得到销售额。
第二个数据管理类:它用于对数据对象的管理,根据你的描述,它至少有以下几个函数:
GetObjectCount();有多少个数据对象
GetOneObjectByName();根据名称读某个数据对象
GetOneObjectByIndex();根据序号读某个数据对象
GetAllObject();得到所有数据对象
ReadFile();从磁盘读数据文件,解析出所有文件中的数据,并存入数据对象
SaveFile();把所有数据对象中的数据保存到磁盘中
AddObject();SetObject();DeletObject();数据对象的增删改。
2.界面显示:界面显示直接调用数据管理类的函数来操作数据类,并把里面的数据显示到你需要的地方,这个你可以在MFC里面创建一个对话框,添加ListControl控件,把所有数据对象类里面的数据都添加到该控件中,根据对控件的增删改查操作来修改后面的数据对象。
希望上面的设计对你又帮助,如果有什么不明白的地方可以发邮件询问,邮件地址[email protected]
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-09-23
/*这是我写的,用到了链表*/
#include<iostream>
#include<string>
#include <stdlib.h>
using namespace std;
class a;
int print(a*head);
class a{

public:
string _number;
string _name;
string _chanpin;
int _danjia;
int _shuliang;
double _e;
a * next;
double e();
a():_number("000000"),_name("空"),_chanpin("空"),_danjia(0),_shuliang(0), _e(0.0){}
a * creat();
};
double a::e()
{
_e=_danjia*_shuliang;
return _e;

}
int manger(a*head)
{
int k;
a* p=head;
int m;
a* back=p;
cout<<"1.查询"<<endl;
cout<<"2.删除"<<endl;
cin>>m;
string nam;
switch(m)
{ case 1:
{
cout<<"请输入查询的姓名"<<endl;
cin>>nam;
while(p!=NULL)
{
if(p->_name==nam)
{

system("cls");
cout<<"查找结果如下:"<<endl;
print(p);
break;
}
p=p->next;
}
if(p==NULL)
{
cout<<"没有此人的记录!"<<endl;
}
break;
cout<<"按1返回,按0退出"<<endl;
cin>>k;
return k;
}
case 2:
{
system("cls");
cout<<"请输入要删除的员工姓名"<<endl;
cin>>nam;
while(p!=NULL)
{
p=p->next;
if(p->_name==nam)
{
back->next=p->next;
free(p);
cout<<"此人信息已删除!"<<endl;
break;
}
}
if(p==NULL)
cout<<"没有此人的记录!"<<endl;
break;
cout<<"按1返回,按0退出"<<endl;
cin>>k;
return k;
}
default:
cout<<"输入有误!"<<endl;
}
}
int print(a*head)
{
int k;
a*p;
p=head;
cout<<endl;
while(p!=NULL)
{
cout<<"员工编号:"<<p->_number<<endl;
cout<<"员工姓名:"<<p->_name <<endl;
cout<<"销售产品:"<<p->_chanpin <<endl;
cout<<"产品单价:"<<p->_danjia <<endl;
cout<<"销售数量:"<<p->_shuliang <<endl;
cout<<"销售额:"<<p->e()<<endl;
cout<<endl;
p=p->next;
}
cout<<"按1返回,按0退出"<<endl;
cin>>k;
return k;
}

a* creat()
{
string number;
string name;
string chanpin;
int danjia;
int shuliang;
a *p;
a *head = new a;
if(head==NULL)
cout<<"内存分配失败!"<<endl;
else
{
cout<<"请输入员工编号:"<<endl;
cin>>number;
head->_number =number;
cout<<"请输入员工姓名:"<<endl;
cin>>name;
head->_name =name;
cout<<"请输入销售产品:"<<endl;
cin>>chanpin;
head->_chanpin =chanpin;
cout<<"请输入产品单价:"<<endl;
cin>>danjia;
head->_danjia =danjia;
cout<<"请输入销售数量:"<<endl;
cin>>shuliang;
head->_shuliang =shuliang;
}
head->next=NULL;
p=head;
while(1)
{
system("cls");
a *New = new a;
cout<<"请输入员工编号:"<<endl;
cin>>number;
if(number=="00")
break;
New->_number =number;
cout<<"请输入员工姓名:"<<endl;
cin>>name;
New->_name =name;
cout<<"请输入销售产品:"<<endl;
cin>>chanpin;
New->_chanpin =chanpin;
cout<<"请输入产品单价:"<<endl;
cin>>danjia;
New->_danjia =danjia;
cout<<"请输入销售数量:"<<endl;
cin>>shuliang;
New->_shuliang =shuliang;
New->next =NULL;
p->next=New;
p=New;
}
return head;
}
void display()
{
a *h;
int d;
int y=1;
while(y)
{
cout<<"请输入要执行的操作:"<<endl;
cout<<"1.输入数据"<<endl;
cout<<"2.输出所有数据"<<endl;
cout<<"3.管理"<<endl;
cin>>d;
switch(d)
{
case 1:
{system("cls");h=creat();break;}
case 2:
{y=print(h);break;}
case 3:
{y=manger(h);break;}
default:
cout<<"输入有误!"<<endl;
}
}
}
main()
{
display();

}
第2个回答  2011-09-25
代码太多了 自己去看下

#include<iostream>
#include<fstream>
#include<string>
#include <iomanip>
#include<windows.h>
#include<ctime>
using namespace std;

const int NAME_NUM=30;

struct student
{
char name[NAME_NUM];
float num;
float chinaNum;
float englishNum;
float mathNum;
float average;
float result;
int pos;
student *next;
};

void Print(student *head);
void InsertFront(student* &head, student *pNew);
void InsertRear(student* &head, student *pNew);
student* Find(student *head, char *findStr, char type);
student* Read();
void Write(student* head);
void ShowList(student* head);
int GetLength(student* head);
void Delete(student* &head, char *delStr,int delNum);
void FindMaxOrMin(student *head,char type,char maxOrMin);
void Reword(student *pStd);
void Sort(student *&head, char type,char maxOrMin);
void Count(student *&head);
void DeleteAll(student *&head);
bool Enter(char type);
void SetTitle(bool isLoad);
void AboutMe();
void ChaXun(string str,student *head);
void PaiMing(string str, student* head);
void ShanChu(string str, student *&head);
void XianShi(string str, student *head);
void XuiGai(string str, student *&head);
void ZengJia(string str, student* &head);
int Run();

bool Enter(char type)
{
ofstream out("Password.pwd",ios::app);
ifstream in("Password.pwd");

string s[2];
int num=0;

string zhangHao;
string miMa;
while(!in.eof())
{
in>>s[num];
num++;
if(num==2)
{
break;
}
}
if(s[0].compare("")==0 || type=='2' )
{

if(s[0].compare("")==0 && type!='2')
{
cout<<"你是第一次使用本程序,请设置帐号和密码."<<endl;
}
else
{
bool isLoad=false;
isLoad=Enter('1');
if(isLoad==true)
{
cout<<"修改用户."<<endl;
out.close();
out.open("Password.pwd",ios::trunc);
}
else
{
cout<<"你输入的密码错误."<<endl;
cout<<"你不是管理员不能修改密码."<<endl;
return false;
}
}
cout<<"请输入您的新帐号: ";
cin>>s[0];
cout<<"请输入您的新密码: ";
cin>>s[1];

string s1,s2;
for(int i=0; i<s[0].size(); i++)
{
s1+=char(int(s[0][i])+11);
}

for( i=0; i<s[1].size(); i++)
{
s2+=char(int(s[1][i])+11);
}
s[0]=s1;
s[1]=s2;
for( i=0; i<=1; i++)
{
out<<s[i]<<" ";
}
out.close();
}

string s1,s2;

for(int i=0; i<s[0].size(); i++)
{
s1+=char(int(s[0][i])-11);
}

for( i=0; i<s[1].size(); i++)
{
s2+=char(int(s[1][i])-11);
}

cout<<"请输入您的帐号: ";
cin>>zhangHao;
cout<<"请输入您的密码: ";
cin>>miMa;

if(zhangHao.compare(s1)==0 && miMa.compare(s2)==0)
{
return true;
}
else
{
return false;
}
return false;
}

void Print(student *head)
{
student *pHead=head;
int num=strlen(head->name);
while(head)
{
if(num<strlen(head->name))
{
num=strlen(head->name);
}
head=head->next;
}
head=pHead;

作者:281011131 封 2007-3-11 16:00 回复此发言

--------------------------------------------------------------------------------

2 C++学生管理系统(原创,链表实现)
cout<<setw(num)<<head->name<<setw(8)
<<head->num<<setw(10)<<head->chinaNum
<<setw(10)<<head->mathNum<<setw(10)
<<head->englishNum<<setw(8)<<head->result
<<setw(8)<<head->average<<setw(5)<<head->pos<<endl;
}

void ShowList(student* head)
{

cout<<"姓名:"<<setw(8)<<"座号:"<<setw(10)
<<"语文分数:"<<setw(10) <<"数学分数:"
<<setw(10)<<"英语分数:"<<setw(8)<<"总分数:"
<<setw(8)<<"平均分:"<<setw(6)<<"名次:"<<endl<<endl;
while(head)
{

Count(head);

Print(head);

head=head->next;
}
cout<<endl;
}

void Write(student* head)
{
ofstream out("Student.dat",ios::trunc);

while(head)
{

Count(head);

out.write((char*)head,sizeof(student));
head=head->next;
}
out.close();
}

student* Read()
{
ifstream in("Student.dat");
student *head;
student *pP;
student *pEnd;
pP=new student;

pEnd=head=pP;

student *pS=new student;
memset(pS->name,0,NAME_NUM);
in.read((char*)pS,sizeof(student));

if(strcmp(pS->name,"\0")==0)
{
return NULL;
}

strcpy(pP->name,pS->name);
pP->num=pS->num;
pP->chinaNum=pS->chinaNum;
pP->englishNum=pS->englishNum;
pP->mathNum=pS->mathNum;

while(!in.eof())
{
in.read((char*)pS,sizeof(student));
pEnd->next=pP;
pEnd=pP;
pP=new student;

strcpy(pP->name,pS->name);
pP->num=pS->num;
pP->chinaNum=pS->chinaNum;
pP->englishNum=pS->englishNum;
pP->mathNum=pS->mathNum;

}

pEnd->next=NULL;
delete pP;
return head;
}

student* Find(student *head,char *findStr, char type)
{
/*参数说明:
type=='1' 按 名字 查找
type=='2' 按 座号 查找
type=='3' 按 语文 查找
type=='4' 按 数学 查找
type=='5' 按 英语 查找
type=='6' 按 总分 查找
type=='7' 按 平均分 查找
type=='8' 按 排名 查找 //没有实现
*/
bool isFind=false;
student *firstStd=NULL;

cout<<"姓名:"<<setw(8)<<"座号:"<<setw(10)
<<"语文分数:"<<setw(10) <<"数学分数:"
<<setw(10)<<"英语分数:"<<setw(8)<<"总分数:"
<<setw(8)<<"平均分:"<<setw(5)<<"名次:"<<endl<<endl;

while(head)
{
if(type=='1')
{
if(strcmp(head->name,findStr)==0)
{
if(firstStd==NULL)
{
firstStd=head;
}
Print(head);

isFind=true;
if(head->next==NULL)
{
return firstStd;
}
}
}
else if(type=='2')
{
if(int(head->num)==int(atof(findStr)))
{
if(firstStd==NULL)
{
firstStd=head;
}
Print(head);

isFind=true;
if(head->next==NULL)
{
return firstStd;
}
}
}
else if(type=='3')
{
if(int(head->chinaNum)==int(atof(findStr)))
{
if(firstStd==NULL)
{
firstStd=head;
}
Print(head);

isFind=true;
if(head->next==NULL)
{
return firstStd;
}
}
}
else if(type=='4')
{
if(int(head->mathNum)==int(atof(findStr)))
{
if(firstStd==NULL)
{
firstStd=head;
}
Print(head);
第3个回答  2011-09-23
这个不是技术的问题,需要时间!懒人还是比较多的!要是真不会,去VC知识库找个类似的改改吧!里面很多
第4个回答  2011-09-23
(3)用户界面设计以菜单形式体现各个功能,供用户选择。各功能之间原则上无先后次序。(4)编写程序代码,调试程序使其能正确运行 代码太多了 自己去
相似回答