c++-这个没错误。怎么什么也运行不出来??

问题描述

这个没错误。怎么什么也运行不出来??

// shiyan66.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include"iomanip"
#include"iostream"
using namespace std;

class Employee

{ public:
Employee(const long n,const char* N){number=n,*name=*N;};
virtual~Employee(){};

const char* getName(long n) const{};
const long getNumber() const{};
virtual double eamings() const=0;

virtual void print() const{cout<<"编号:"<
protected:
long number;
char *name;
};
class Manager: public Employee
{ public:
Manager(const long n,const char* N,double u ):Employee(n, N){monthlySalary=u;}
~Manager(){};
void setMonthlySalary(long n){number=n;};
virtual double eamings() const{return 0;};
virtual void print() const{cout
private:
double monthlySalary;
};
class HourlyWorker: public Employee
{ public:
HourlyWorker(const long n,const char* N,double=0.0, int=0):Employee(n, N){number=n,*name=*N;};
~HourlyWorker(){}
void setWage(double h){hours=h;};
void setHours(int w){wage=w;};
virtual double eamings() const{return hours*wage; };
virtual void print() const{cout
private:
double wage;
double hours;
};
class PieceWorker: public Employee
{ public:
PieceWorker(const long n,const char* N,double=0.0, int=0):Employee(n, N){number=n,*name=*N;};
~PieceWorker(){}
void setWage(double w){wagePerPiece=w;};
void setQuantity(int q){quantity=q;};
virtual double eamings() const{return wagePerPiece*quantity;};
virtual void print() const{cout
private:
double wagePerPiece;
int quantity;
};
int main()
{ cout
Manager m1(10135,"Cheng ShaoHua", 1200) ;
Manager m2(10201,"Yan HaiFeng",1000);
m2.setMonthlySalary ( 5300) ;
HourlyWorker hw1(30712,"Zhao XiaoMing",5,8*20) ;
HourlyWorker hw2(30649,"Gao DongSheng" ,6,98*8) ;
hw2.setWage(4.5) ;
hw2.setHours(10*30) ;
PieceWorker pw1(20382,"Xiu LiWei",0.5,2850) ;
PieceWorker pw2(20496,"Huang DongLin" ,1,23*10) ;
pw2.setWage(0.75);
pw2.setQuantity (1850);
Employee*basePtr;
basePtr=&m1 ; basePtr=&m2; basePtr=&hw1 ; basePtr=&hw2 ; basePtr=&pw1 ; basePtr=&pw2 ;
basePtr->print(); basePtr->print(); basePtr->print(); basePtr->print(); basePtr->print(); basePtr->print();
return 0;
}

解决方案

不要用"" 要用<>
只有自己写的头文件才使用""

解决方案二:

不要用"" 要用<>
只有自己写的头文件才使用""

解决方案三:

不要用"" 要用<>
只有自己写的头文件才使用""

解决方案四:

不要用"" 要用<>
只有自己写的头文件才使用""

解决方案五:

不要用"" 要用<>
只有自己写的头文件才使用""

解决方案六:

不要用"" 要用<>
只有自己写的头文件才使用""

解决方案七:

using namespace std;
应该写在第一行。
#include"iostream"等等标准库引用应该改为#include 。
还要注意:老的C++标准引用库文件 #include ,需要加 .h扩展名。
而C++ 99标准开始采用如等格式。

解决方案八:

不要用"" 要用<>
只有自己写的头文件才使用""

解决方案九:

感觉这个人疯了,绝对是不知道从什么地方复制粘贴了一段代码,很可能是从pdf里面复制出来的,然后就直接贴在这问问题!!

解决方案十:

你确定这段代码能编译通过吗?嘿嘿。
至少class Employee里面成员函数print()花括号不匹配。

时间: 2024-08-31 19:09:37

c++-这个没错误。怎么什么也运行不出来??的相关文章

c语言问题-大家好,下面这段程序在vc6.0中编译时没错误,但却运行不起来。麻烦帮看一下

问题描述 大家好,下面这段程序在vc6.0中编译时没错误,但却运行不起来.麻烦帮看一下 #include #include int main() { int shu,shang,i,yushu; int a[16]={0}; clrscr(); printf("shu ru yi ge shu shi jin zhin "); scanf("%d",shu); for(i=0;i { yushu=shu%2; shang=shu/2; a[i]=yushu; shu

android linearlayout-android代码没错误提示,无法运行,求帮助!

问题描述 android代码没错误提示,无法运行,求帮助! package com.example.android_5_1; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; public class M

using-C++编译没错误,运行停止工作,菜鸟求指点

问题描述 C++编译没错误,运行停止工作,菜鸟求指点 #include #include using namespace std; int main() { string ch = ""; char*p=&ch[0]; cout <<"input cipher code:"; gets(p); cout <<"cipher code:"<<ch<<endl; int j=0; for(j=0

c语言 链表 输入问题,编译没错误, 运行 错误

问题描述 c语言 链表 输入问题,编译没错误, 运行 错误 #include #define M 20 int f(char a[]) { int i ; i=0; while (a[i]='n') i++; i--; while (i>0&& a[i]==' '||a[i]=='t') i--; if(i>0) { i++; a[i]='n'; i++; a[i]=''; } return 1; } int getline (char s[],int lim ) { int

c++-程序没错误没错误,可是运行不了

问题描述 程序没错误没错误,可是运行不了 #include #include #include using namespace std; class work { public: work(int n,string nam,int a,float wa) { num=n;name=nam;a=age;wag=wa; } friend ostream &operator <<(ostream &output,work &d) { output<<"号

visual c# access-visual c# 和access的 运行没错误,但是调试了运行没反应 button2

问题描述 visual c# 和access的 运行没错误,但是调试了运行没反应 button2 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data

android程序,eclipse没报错,但是运行会意外停止

问题描述 android程序,eclipse没报错,但是运行会意外停止 本人刚开始学习android,跟着书写了个程序,这个程序是会有一个东西随着手指拖动而移动,编译完没有问题,但是在手机上运行的时候却是意外停止,错误显示在了MainActivity的第27行,我真不知道哪里错,代码和书上写的一模一样,求大神指导 MainActivity的代码: package com.example.test34; import android.app.Activity; import android.os.

eclipse android-在BOIS里面已开启VT,但安装HAXM时还是提示错误,VT未运行

问题描述 在BOIS里面已开启VT,但安装HAXM时还是提示错误,VT未运行 大神帮帮忙, 在BOIS里面已开启VT,但安装HAXM时还是提示错误,VT未运行 解决方案 cpu本身是什么型号,部分celeron和pentium处理器硬件不支持,那就没办法了. 解决方案二: http://jingyan.baidu.com/article/e4d08ffdb298080fd2f60dc1.html 解决方案三: 噢噢,我知道怎么回事了,原来没安装蓝牙驱动,把蓝牙驱动安装了就能安装了,也不知道为啥

=号附近有语法错误 看来看去都没找到 sql语句没错误呀

问题描述 =号附近有语法错误 看来看去都没找到 sql语句没错误呀 private void button1_Click(object sender, EventArgs e) { string sql = "select count(*) from T_USER where users='" + tb_user.Text.Trim() + "'"; DataSet ds = account.Getdateset(sql); if (ds != null &