首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

大家帮帮忙拉!100分!

2012-02-26 
大家帮帮忙拉!!!!100分求救!!!--------------------Configuration:1-Win32Debug--------------------Compi

大家帮帮忙拉!!!!100分求救!!!
--------------------Configuration:   1   -   Win32   Debug--------------------
Compiling...
1.cpp
G:\C++\工程\hxl\1.cpp(263)   :   error   C2535:   'void   __thiscall   sell_manager::display(void) '   :   member   function   already   defined   or   declared
                G:\C++\工程\hxl\1.cpp(220)   :   see   declaration   of   'display '
G:\C++\工程\hxl\1.cpp(271)   :   error   C2535:   'void   __thiscall   sell_manager::put_date(void) '   :   member   function   already   defined   or   declared
                G:\C++\工程\hxl\1.cpp(221)   :   see   declaration   of   'put_date '
G:\C++\工程\hxl\1.cpp(324)   :   fatal   error   C1004:   unexpected   end   of   file   found
Error   executing   cl.exe.

1.obj   -   3   error(s),   0   warning(s)

就是销售经理的那个类错了~~~不知道为什么屏蔽掉那个类就没事了
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using   namespace   std;
//////////////////////////////////////////////基类///////////////////////////////
class   Employee
{      
public:
        Employee(){}
void   set_date();
        void   print(){}
void   display(){}
void   put_date(){}
protected:
        intnumber;
int   age;
double   income;
string   name;
string   post;
int   sex;
};
void   Employee::set_date()
{
        cout < < "please   enter   number: " < <endl;
cin> > number;
cout < < "please   enter   age: " < <endl;
cin> > age;
cout < < "please   enter   income: " < <endl;
cin> > income;
cout < < "please   enter   name: " < <endl;
        cin> > name;
cout < < "please   enter   post: " < <endl;
cin> > post;
cout < < "please   enter   sex: " < <endl;
cin> > sex;
}
//////////////////////////////技术员类///////////////////////////////////
class   Technician:   virtual   public   Employee
{
        public:
        Technician(){hourlyrate=100;}  
void   display();
void   put_date();
void   fun()
{       int   time;
        Employee::set_date();
cout < < "please   enter   work   time   is: " < <endl;
cin> > time;
        income=hourlyrate*time;
}
        void   print()  
{  
cout < < "┌—————┬—————┬—————┬—————┬—————┐ " < <endl;
cout < < "│ " < <setw(10) < < "number "
        < < "│ " < <setw(10) < < "name "
< < "│ " < <setw(10) < < "sex "
< < "│ " < <setw(10) < < "age "
< < "│ " < <setw(10) < < "income "


< < "│ " < <endl;  
cout < < "├—————┼—————┼—————┼—————┼—————┤ " < <endl;
cout < < "│ " < <setw(10) < <number
        < < "│ " < <setw(10) < <name
< < "│ " < <setw(10) < <sex
< < "│ " < <setw(10) < <age
< < "│ " < <setw(10) < <income
< < "│ " < <endl;

}  

protected:
int   hourlyrate;
int   time;
};
Technician   t[4],*p;

void   Technician::display()
  {      
 
  int   k=0;
  for   (k;k <4;k++)
{
t[k].fun();
}
}
void   Technician::put_date()
{

  int   k=0;
  for   (k;k <4;k++)
{
t[k].print();
}
}
void   General_Technician()
{
        p-> display();
        p-> put_date();

}
//////////////////经理类////////////////////////////////
class   manager:   virtual   public   Employee
{
        public:
        manager(){pay=8000;}  
void   display();
void   put_date();
void   fun()
{    
        Employee::set_date();
}
        void   print()  
{  
cout < < "┌—————┬—————┬—————┬—————┬—————┐ " < <endl;
cout < < "│ " < <setw(10) < < "number "
        < < "│ " < <setw(10) < < "name "
< < "│ " < <setw(10) < < "sex "
< < "│ " < <setw(10) < < "age "
< < "│ " < <setw(10) < < "income "
< < "│ " < <endl;  
cout < < "├—————┼—————┼—————┼—————┼—————┤ " < <endl;
cout < < "│ " < <setw(10) < <number
        < < "│ " < <setw(10) < <name
< < "│ " < <setw(10) < <sex
< < "│ " < <setw(10) < <age
< < "│ " < <setw(10) < <pay
< < "│ " < <endl;
}  
protected:
intpay;
};
manager   m[4],*p1;
void   manager::display()
  {      
 
  int   k=0;
  for   (k;k <4;k++)
{
m[k].fun();
}
}
void   manager::put_date()
{
  int   k=0;
  for   (k;k <4;k++)
{
m[k].print();
}
}
void   General_manager()
{
        p1-> display();
        p1-> put_date();

}
////////////////////////////销售员//////////////////////////////////
class   seller:   virtual   public   Employee
{
        public:
        seller(){percentage=0.5;}  
void   display();
void   put_date();
void   fun()
{       int   total;
        Employee::set_date();
cout < < "please   enter   total   is: " < <endl;


cin> > total;
        income=percentage*total;
}
        void   print()  
{  
cout < < "┌—————┬—————┬—————┬—————┬—————┐ " < <endl;
cout < < "│ " < <setw(10) < < "number "
        < < "│ " < <setw(10) < < "name "
< < "│ " < <setw(10) < < "sex "
< < "│ " < <setw(10) < < "age "
< < "│ " < <setw(10) < < "income "
< < "│ " < <endl;  
cout < < "├—————┼—————┼—————┼—————┼—————┤ " < <endl;
cout < < "│ " < <setw(10) < <number
        < < "│ " < <setw(10) < <name
< < "│ " < <setw(10) < <sex
< < "│ " < <setw(10) < <age
< < "│ " < <setw(10) < <income
< < "│ " < <endl;
}   int   total;
protected:
int   percentage;

};
seller   A[4],B[4],C[4],D[4],*p2;
void   seller::display()
  {      
 
  int   k=0;
  for   (k;k <4;k++)
{
A[k].fun();
}
}
void   seller::put_date()
{
  int   k=0;
  for   (k;k <4;k++)
{
A[k].print();
}
}

void   General_seller()
{
        p2-> display();
        p2-> put_date();
}
/////////////////////////////////////销售经理//////////////////////////////
class   sell_manager:   virtual   public   seller,virtual   public   manager
{
        public:
        sell_manager(){percentage=0.5,pay=8000;}  
void   display();
void   put_date();
void   fun()
{       double   maxA=0;maxB=0;maxC=0;maxD=0;
        Employee::set_date();
for(int   i;i <4;i++)
{
maxA=maxA+A[i].total;
maxB=maxB+B[i].total;
maxC=maxC+C[i].total;
maxD=maxD+D[i].total;
}
double   payA=pay+percentage*maxA;
doublepayB=pay+percentage*maxB;
doublepayC=pay+percentage*maxC;
doublepayD=pay+percentage*maxD;
        void   print()  
{  
cout < < "┌—————┬—————┬—————┐ " < <endl;
cout < < "│ " < <setw(10) < < "number "
        < < "│ " < <setw(10) < < "name "
< < "│ " < <setw(10) < < "销售额 "
< < "│ " < <endl;  
cout < < "├—————┼—————┼—————┤ " < <endl;
cout < < "│ " < <setw(10) < <number
        < < "│ " < <setw(10) < <name
< < "│ " < <setw(10) < <sex
< < "│ " < <endl;
}  
protected:
double   maxA;
double   maxB;
double   maxC;
double   maxD;
double   payA;
double   payB;
double   payC;
double   payD;
};
seller   sa[4],*p3;


void   sell_manager::display()


  {      
  int   k=0;
  for   (;k <4;k++)
{
sa[k].fun();
}
}
void   sell_manager::put_date()
{
  int   k=0;
  for   (;k <4;k++)
{
sa[k].print();
}
}

void   General_seller()
{
        p3-> display();
        p3-> put_date();
}
int   main()
{        
int   i;
cout < < "※※※※※※※※※※※※※※※※※※※※ " < <endl;
cout < < "※                 欢迎使用本软件                             ※ " < <endl;                                        
cout < < "※                 输入数据请按1                               ※ " < <endl;
cout < < "※                                                                         ※ " < <endl;
cout < < "※                                                                         ※ " < <endl;  
cout < < "※                                                                         ※ " < <endl;
cout < < "※                                                                         ※ " < <endl;  
cout < < "※                                                                         ※ " < <endl;    
cout < < "※                                                                         ※ " < <endl;
cout < < "※                                                                         ※ " < <endl;          
cout < < "※                                                                         ※ " < <endl;        


cout < < "※                                                                         ※ " < <endl;        
cout < < "※                                                                         ※ " < <endl;
cout < < "※※※※※※※※※※※※※※※※※※※※ " < <endl;;
cin> > i;
//switch(i)   {
//case   1   :General();
//break;seller
  General_Technician();
  General_manager();
  General_seller();
  return   0;
}




[解决办法]
重载~
[解决办法]
1。你的class sell_manager中的void fun()函数缺少“}”
2。你有2个General_seller()定义,请检查一下。
[解决办法]
帮顶
[解决办法]
1.cpp
G:\C++\工程\hxl\1.cpp(263) : error C2535: 'void __thiscall sell_manager::display(void) ' : member function already defined or declared
G:\C++\工程\hxl\1.cpp(220) : see declaration of 'display '
重复声明了两个函数.

G:\C++\工程\hxl\1.cpp(271) : error C2535: 'void __thiscall sell_manager::put_date(void) ' : member function already defined or declared
G:\C++\工程\hxl\1.cpp(221) : see declaration of 'put_date '
G:\C++\工程\hxl\1.cpp(324) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
一定是你没有写好分号花括号耐心的找.
[解决办法]
编码风格很重要哦,注意缩进可以避免这种错误。
[解决办法]
编程风格很重要
多加注释 让人家看得也没有那么辛苦

[解决办法]
呵呵,在csdn上,不管你的编译风格多好,发上来后都是一个样.

热点排行