error C2653: 'iso_base' : is not a class or namespace name
//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
我对过代码了,没发现问题在哪里!
希望能得到以上三个错误的 原因!!
谢谢!!!
~~~~~~~~~~~~~~~~~~~~~~