《数据结构》课程设计:咨询电话管理系统——信管113309

一、问题描述

   赵斌是一个信管专业的学生,大学四年顺利毕业了。在毕业季,他也像其他学子一样,投身于求职大军,投出一份又一份求职简历,在苦苦地等待之后,他接到了中国移动通信公司广东分司的面试通知书,通知他于本月110点到公司面试。当天,晴空万里,艳阳高照,他身着西装,高兴地早早来到公司楼下等待。10点钟整,他和其他新人一起,坐到公司的面试现场。他领取的一一份程序设计题: 假如你是我公司一名客服技术人员,现请你选择自己熟悉的语言,来设计一个程序,管理客户向公司打进来的咨询电话。请事行分析析使用方法和工具,说明自己的思路方法,写一份完整的程序,并实例测试。

 

二、功能说明

此程序可管理所有打入该公司的咨询电话,并及时反馈客服目前的服务情况,也可向客户反应前面客户的数量及需要等待时长。

定义一个队列CustomerService,每次电话打进来时将其入队,电话接入客服时可将其出队。

在整体的设计上将程序分为三个部分,第一个部分

“CustomerTeleManagement.h”在这个文件中对所要用到的队列 CustomerService进行了声明,第二个文件“CustomerTeleManagement.cpp”是对在“CustomerTeleManagement.h”中所声明的队列 CustomerService定义了一个实体,也可以说是完成了管理咨询电话的操作函数,第三个文件“CustomerTeleManagement_main.cpp“是主函数 main()所在文件,在其中不仅定义了主函数,而且完成了咨询电话管理操作函数。

三个文件各有各的内容,实现了不同的功能,同时也在查错和对程序的维护方面带来很多便利。程序运行时,首先输入电话号码并对该号码编号,然后入队,入队后即可等待客服。

 

三、程序分析

        定义了队列CustomerService,该队列表示打进来的但未接通客服的电话。该队列主要定义了入队函数Insert、出队函数OutLian、取对头元素函数GetLian、判空函数Empty等,对管理咨询电话起了很大作用。

入队函数Insert:将打入的但未接通客服的电话入队;

出队函数OutLian:将队里的电话接通客服;

取对头元素函数GetLian:获得当前接受服务的电话;

判空函数Empty:判断当前队列是否为空。

 

运行结果如图:



四、收获总结

学数据结构这一个学期以来,做了很多次实验,但这次是第一次完全自己写一个可以实现其特定的程序。

在这个过程中,我通过运用课本上及老师课堂上补充的很多知识点,让我发现了知识的重要性,老师平时讲的很多重点是编程时需要注意的,一不注意很可能就会出错。同时这个课程设计也让我了解了基础的重要性,学习没有捷径,每一步我们都要认认真真的学,打好基础才能有提升的可能。

这次课程设计中遇到了一些问题与同学一起讨论解决,让我明白同学间合作的重要性。这个课程设计并不完美,还有很多要改善的地方,通过这次课程设计,让我进一步了解了C++程序设计方法。更重要的是培养了自己耐心、细心、用心的良好品质。希望以后能有机会对这门课进行更深一步的了解,也很乐意通过自己的努力来提高自己在这个知识领域的水平。同时也非常感谢同学的帮助及老师的建议与指导。

 

五、程序代码

CustomerTeleManagement.h:

template<class Hong>        
struct Node  
{  
    Hong data;
	Hong num;
	Hong tel_num;
    Node<Hong> *next;   
};  

const int m=100;               

template<class Hong>     

class CustomerService  
{  
public:  
    CustomerService();                
    ~CustomerService();              
    void Insert(Hong x,int d,long f);   
    Hong OutLian();       
    Hong GetLian();       
    int Empty();              
	int waiting(int i,int d);
	Hong tel();
private:  
    Node<Hong> *front,*rear;     
};   



CustomerTeleManagement.cpp:

#include<string>
#include"CustomerTeleManagement.h"              
                                  
template<class Hong>  
CustomerService<Hong>::CustomerService()      
{  
    Node<Hong> * s=NULL;    
    s=new Node<Hong>;  
    s->next=NULL;  
    rear=s;  
    front=s;  
}  
  
template<class Hong>  
CustomerService<Hong>::~CustomerService()     
{  
    Node<Hong>*p=NULL;    
    while(front!=NULL)            
    {  
        p=front->next;  
        delete front;  
        front=p;  
    }  
}  
  
template<class Hong>  
void CustomerService<Hong>::Insert(Hong x,int d,long f)  
{  
    Node<Hong>*k=NULL;  
    k=new Node<Hong>;  
    k->data=x;              
	k->num=d;          
	k->tel_num=f;       
    k->next=NULL;  
    rear->next=k;   rear=k;       
}  
  
template<class Hong>  
Hong CustomerService<Hong>::OutLian()  
{  
    Node<Hong>*m=NULL;    
    m=new Node<Hong>;  
    if(rear==front)throw"下溢";  
    m=front->next;  
    int g,h,j;  
    g=m->data;                      	
	h=m->num;                     
	j=m->tel_num;                 
    front->next=m->next;           
    if(m->next==NULL)rear=front;    
    delete m;  
    return g,h,j;                     
}  
  
template<class Hong>  
Hong CustomerService<Hong>::GetLian()  
{  
    if(front!=rear)  
		return front->next->num;
}  
  
template<class Hong>  
int CustomerService<Hong>::Empty()  
{  
    if(front==rear)
        return 1;  
    else  
        return 0;  
}  

template<class Hong>   
int CustomerService<Hong>::waiting(int i,int d)
{
	int c;
	c=i*d;
	return c;               
}
template<class Hong>
Hong CustomerService<Hong>::tel()
{
	if(front!=rear)
		 return front->next->tel_num;   
}



CustomerTeleManagement_main.cpp:

#include<iostream> 
#include<iomanip>
#include"CustomerTeleManagement.cpp"
using namespace std;
void main()  
{  
	int count=0,b;
	char a;
	long e;
    CustomerService<int> L;    
    if(L.Empty())  
	{   
		cout<<"\t------欢迎致电中国移动通信公司广东分公司!------"<<endl;
	}
    else
        cout<<"\t队伍非空"<<endl;
	cout<<"\t有客户来电,估计本次通话时间(分钟):";
	cin>>b;
	cout<<"\t正在呼入的号码(#):";
	while(cin>>a)
	{
		try
		{
			cin>>e;
		    count++;
		    L.Insert(a,count,e);    
		}  
		catch(char *q)
		{
			cout<<q<<endl;
		}
	}
    cout<<endl;
	cout<<"\t---目前客服正在通话的编号为:"<<L.GetLian()<<"---"<<endl;
	cout<<"\t"<<endl;
	cout<<"\t---正在服务的是:"<<L.tel()<<"---"<<endl;
	cout<<"\t"<<endl;
	cout<<"\t---你前面还有"<<count<<"位客人,请等候约"<<L.waiting(b,count)<<"分钟---"<<endl;
	
	_sleep(5*1000);//延迟5秒
		cout<<"\t---结束第"<<L.GetLian()<<"位客人的服务---"<<endl;  
    try
	{
		L.OutLian();
	}  
    catch(char *q)  
    {  
        cout<<q<<endl;
	}  
    if(L.Empty())  
        cout<<"\t队伍为空"<<endl;  
    else 
	{
		cout<<"\t即将为第"<<L.GetLian()<<"位客人服务"<<endl;
	    cout<<"\tWe are working for the next"<<endl;
		cout<<"\t此号码正在等待客服:"<<L.tel()<<endl;
	}
} 


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值