错误cxx0030表达式无法评估

时间:2015-01-06 16:14:04

标签: c++ visual-c++

当我使用Visual Studio 2010构建此程序时没有错误,但在调试时,它传达了错误cxx0030表达式无法在HoTenSTK进行评估。 / p>

#include <iostream>
#include <conio.h>
#include <stdio.h>

using namespace std;

class savingAccount
{
private:

char *HoTen;
char *STK;
static double AnnualInterestRate;   //ty suat
double savingBalance;   //tai khoan hien co
double MonthlyInterest;   //lai hang thang

public:
//double MonthlyInterest;
savingAccount()
{
    HoTen=new char[30];
    STK=new char[20];
    savingBalance=0.0;
    MonthlyInterest=0.0;
}
~savingAccount()
{
    delete this->HoTen;
    delete this->STK;
    savingBalance=0.0;
    MonthlyInterest=0.0;
}


void In();    //Nhap thong tin khach hang
void Out();    //Xuat thong tin khach hang,tai khoan hien co
static void change_annual_interest_rate();
static void out_annual_interest_rate();
void monthly_interest();
void out_monthly_interest();

};


 void savingAccount::In()
 {
cout <<"\n Nhap thong tin khach hang:  "<<endl;
cout <<"\n Ho ten:   "; fflush(stdin); scanf("%s",&HoTen);
cout <<"\n So tai khoan:  "; fflush(stdin); scanf("%s",&STK);
cout <<"\n Tien gui vao tai khoan:   "; cin>>savingBalance;
}

void savingAccount::Out()
{
cout <<"\n Ho ten:   "<<HoTen;
cout <<"\n So tai khoan:  "<<STK;
cout <<"\n Tai khoan hien co:  "<<savingBalance;

 }

 void savingAccount::change_annual_interest_rate()
{
cout <<"\n Ty suat tien gui cu: "<<AnnualInterestRate;
cout <<"\n Nhap ty suat moi:    "; cin>>AnnualInterestRate;
 }



 void savingAccount::out_annual_interest_rate()
 {
cout <<"\n Ty suat tien gui:  "<<AnnualInterestRate<<endl;
}


 void savingAccount::monthly_interest()
{
MonthlyInterest=savingBalance*AnnualInterestRate/12;
savingBalance+=MonthlyInterest;
}

void savingAccount::out_monthly_interest()
{
cout <<"\n Lai suat thang nhan duoc:  "<<MonthlyInterest;
}

double savingAccount::AnnualInterestRate=0.0;

void main()
{
savingAccount saver1,saver2;
saver1.In();
saver2.In();
saver1.Out();
savingAccount::change_annual_interest_rate();
saver1.monthly_interest();
saver2.monthly_interest();
saver1.Out();
saver1.out_monthly_interest();
saver2.Out();
saver2.out_monthly_interest();
savingAccount::change_annual_interest_rate();
saver1.monthly_interest();
saver1.Out();
saver1.out_monthly_interest();
saver2.monthly_interest();
saver2.Out();
saver2.out_monthly_interest();
getch();
}

0 个答案:

没有答案