⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fixed.cpp

📁 ThinkingC++中文版答案 ThinkingC++中文版答案
💻 CPP
字号:
//fixed.cpp

#include "fixed.h"
#include <iostream.h>
#include <string.h>
#include <stdlib.h>

Fixed::Fixed(unsigned accNo, float balan)
  :Savings(accNo, balan)
{
  int interval;
  cout <<"please select a number of fixed year(1, 3, 5):\n";
	cin >>interval;
	switch(interval){
		case 1: rate=1.05f;  break;
		case 3: rate=1.08f;  break;
		case 5: rate=1.1f;  break;
		default: rate=1.08f;
	}
	_strdate(validDay);
  char strYear[3];
	strcpy(strYear, &validDay[6]);
	int intYear = atoi(strYear)+interval;
	_itoa(intYear,strYear,10);
	strcpy(&validDay[6], strYear);
}

bool Fixed::VerifyDate() const
{
  char strToday[9];
	_strdate(strToday);
	return strcmp(strToday, validDay) >= 0;
}

void Fixed::Withdrawal(float amount)
{
  if(balance){
	  balance *= (VerifyDate() ? rate : 1.01f);
	  Display();
	  balance=0;
	}
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -