error C2653: 'iso_base' : is not a class or namespace name

hjk_thinking 2008-11-27 01:06:30
//brass.h

#ifndef BRASS_H_
#define BRASS_H_

class Brass
{
private:
static const int MAX = 35;
char fullname[MAX];
long acctNum;
double balance;
public:
Brass(const char *s = "nullbody", long an = -1, double bal = 0.0);
void Deposit(double amt);
virtual void Withdraw(double amt);
double Balance()const;
virtual void ViewAcct()const;
virtual ~Brass(){}
};

//Brass plus Account class

class BrassPlus:public Brass
{
private:
double maxLoan;
double rate;
double owesBank;

public:
BrassPlus(const char *s = "nullbody", long an = -1,
double bal = 0.0, double ml = 500, double r = 0.10);
BrassPlus(const Brass &ba, double ml = 500, double r = 0.1);

virtual void ViewAcct()const;
virtual void Withdraw(double amt);

void ResetMax(double m){ maxLoan = m; }
void ResetRate(double r){ rate = r; }

void ResetOwes(){ owesBank = 0; }

};
#endif




//brass.cpp

#include<iostream>
#include<cstring>
using namespace std;

#include "brass.h"


Brass::Brass(const char *s, long an, double bal)
{
strncpy(fullname, s, MAX - 1);
fullname[MAX - 1];
acctNum = an;
balance = bal;


}

void Brass::Deposit(double amt)
{
if( amt < 0)
{
cout << "negative deposit not allowed, withdrawal canceled\n";
}

else
{
balance += amt;
}
}

void Brass::Withdraw(double amt)
{
if(amt < 0)
{
cout << "negative deposit not allowed;"
<< "withdrawal canceled \n";
}
else if( amt <= balance)
{
balance -= amt;
}
else
{
cout <<"withdrawal amount of $" << amt
<< "exceed your balance \n"
<<"withdrawal cancelled. \n";
}
}

double Brass::Balance() const
{
return balance;
}

void Brass::ViewAcct() const
{
iso_base::fmtflags initialState = cout.setf(iso_base::fixed, iso_base::floatfield);
cout.setf(iso_base::showpoint);
cout.precision(2);


cout << "client : " <<fullname <<endl;
cout << "Account number :" << acctNum <<endl;
cout << "balance : $ " <<balance <<endl;

cout.setf(initialState);
}

//brassplus methods

BrassPlus::BrassPlus(const char *s, long an, double bal,
double ml, double r):Brass(s, an , bal)
{
maxLoan = ml;
owesBank = 0.0;
rate = r;
}

BrassPlus::BrassPlus(const Brass &ba, double ml, double r):Brass(ba)
{
maxLoan = ml;
owesBank = 0.0;
rate = r;
}

//redifne how ViewAcct() works

void BrassPlus::ViewAcct()const
{


Brass::ViewAcct();

cout << "maximum loans: $ " << maxLoan <<endl;
cout << "owed to bank :" << owesBank <<endl;
cout << "loan rate : " << 100 * rate << "%\n";

cout.setf(initialState);
}


//redefine how withdraw() works

void BrassPlus::Withdraw(double amt)
{

iso_base::fmtflag initialState =
cout.setf(iso_base::fixed, iso_base::floatfield);
cout.setf(iso_base::showpoint);
cout.precision(2);


double bal = Balance();

if(amt <= bal)
{
Brass::Withdraw(amt);

}
else if (amt <= bal + maxLoan - owesBank)
{
double advance = amt - bal;
owesBank += advance * (1.0 + rate);

cout << "bank advance: " << advance << endl;
cout << "finance charge :" << advance * rate <<endl;

Deposit(advance);
Brass::Withdraw(amt);

}
else
{
cout << "credit limit exceeded . Transaction cancelled . \n";
cout.sef(initialState);

}

}


int main()
{
Brass P("ppp", 1111, 11.1101);
BrassPlus H("HHH", 2222, 22.22);

P.ViewAcct();
cout << endl;

H.ViewAcct();
cout << endl;

cout << "deposit 1000 into the H \n";
H.Deposit(1000.0);
cout << "new balance: " << H.Balance() <<endl;
cout << "withdrawing: 4200 from the P account :\n";

P.Withdraw(4200.0);

cout << "pigg account balance : " << P.Balance() <<endl;
cout << "withdraw $4200 from H account\n: ";
H.Withdraw(4200.0);
H.ViewAcct();
return 0;
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning C4996: 'strncpy' was declared deprecated

error C2653: 'iso_base' : is not a class or namespace name

error C2664: 'std::ios_base::fmtflags std::ios_base::setf(std::ios_base::fmtflags)' : cannot convert parameter 1 from 'std::ios_base &(__cdecl *)(std::ios_base &)' to 'std::ios_base::fmtflags'
1> There is no context in which this conversion is possible
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
这个warming c4996 为什么老出现 我已经包含了 #include<cstring> 了,我用VC6的时候 没这个警告
然后是是'iso_base' : is not a class or namespace name
我对过代码了,没发现问题在哪里!

希望能得到以上三个错误的 原因!!
谢谢!!!
~~~~~~~~~~~~~~~~~~~~~~

...全文
1947 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
geniuswitch225 2011-06-03
  • 打赏
  • 举报
回复
大哥们在说什么呢?
chen2009zhou 2011-05-31
  • 打赏
  • 举报
回复
是ios_base
WingForce 2008-11-27
  • 打赏
  • 举报
回复
是ios_base
taodm 2008-11-27
  • 打赏
  • 举报
回复
ios_base
随着通信电子技术的迅速发展,信息技术给家居行业产生了深远的影响,家居环境的智能化监控已经成为智能家居的一个重要的发展方向。人们逐渐对自己的生活提出一种更高的要求,他们需要一种智能化、可交互,并且融合现代创新科技的产品来改善他们的生活环境,使他们生活更加安全、舒适、便捷、智能。本文根据智能家居的发展背景和研究现状,并且从实用性和可行性角度出发,研究设计了一种基于STM32单片机的智能家居系统。该系统由一个多功能综合的技术系统组成,各个多功能子系统间具有协同配合能力。基于STM32单片机实现的功能子系统包括:智能温度检测,智能湿度检测,智能烟雾/火灾检测智能检测,无线传输,人机交互机构,风扇调节,报警模块。 整个系统分为前端51单片机采集板和后端STM32单片机接收板。 采集板使用DHT11温湿度传感器、MQ烟雾传感器完成室内家居环境的采集。然后通过nRFL24L01将采集到的数据发送给后端。接收板使用LCD1602完成数据显示、使用蜂鸣器模块报警,使用风扇驱动模块调节室内家居环境。本文完成了智能家居控制系统前端、后端软硬件的设计,使用Altium designer绘制了电路原理图,使用Keil C完成了51单片机和STM32单片机的编程与调试。 最后,对本文设计的基于STM32的智能家居控制系统进行部署调试。试验结果表明,该系统可成功应用在智能家居环境检测调节和火灾安全防护的领域,可提高家居生活智能化水平。

65,210

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧