下载此文档

宿舍系统代码实现.doc


文档分类:IT计算机 | 页数:约22页 举报非法文档有奖
1/22
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/22 下载此文档
文档列表 文档介绍
VC++
由于数据库暂时没学会,利用了文本文件进行保存修改用户数据
#include "iostream"
#include"string"
#include"fstream"
#include"iomanip"
using namespace std;
int count1=0,count11=0; //学生总数和交钱的人数
int count2=0,count22=0;
class Stu
{
public:
Stu(double xwater=0,double xpower=0,double xgas=0,string xnum="a",string xna="a"); //学生类构造函数
void operator =(Stu S); //赋值运算符重载
friend ostream &operator <<(ostream & a,Stu &S) //插入运算符重载
{ a<<setw(8)<<left<<;
a<<setw(8)<<left<<;//输出时左对齐8位
a<<setw(8)<<left<<;
a<<setw(8)<<left<<;
a<<setw(8)<<left<<;
a<<setw(8)<<left<<();
a<<setw(8)<<left<<();
a<<setw(8)<<left<<();
a<<setw(8)<<left<<();
if(!=0)
a<<"已交";
else a<<"未交";
cout<<endl;
return a;
}

double SGetW(); //计算水费
double SGetC(); //计算电费
double SGetG(); //计算煤气费
double Stotal(); //计算总费用
double water,power,gas,water_rate,circuit,gas_rate,total;
int flag;
string number,name;
};
Stu::Stu(double xwater,double xpower,double xgas,string xnum,string xna) //学生类构造函数
{
water=xwater;power=xpower;gas=xgas;
number=xnum;name=xna;
flag=0;
}
void Stu::operator =(Stu S) //赋值运算符重载
{
name=;
number=;
water=;
power=;
gas=;

}

double Stu::SGetW( ) //计算水费
{
if(water<10)
water_rate=0;
else
water_rate=*(water-10);
return water_rate;
}
double Stu::SGetC() //计算电费
{
if(power<10)
circuit=0;
else
circuit=*(power-10);
return circuit;
}
double Stu::SGetG() //计算煤气费
{
if(gas<10)
gas_rate=0;
else
gas_rate=*(gas-10);
return gas_rate;
}
double Stu::Stotal() //计算总的钱
{
total=SGetG()+SGetW()+SGetC();
return total;
}
//*************************************************************************************
class arrayofStu //学生类计算
{
public:
arrayofStu(int sz=1) {size=sz; student=new Stu[size];} //构造函数
~arrayofStu() { delete [] student; }
void xuesheng(); //学生用户主菜单
void jiaofei(); //学生交费菜单

宿舍系统代码实现 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数22
  • 收藏数0 收藏
  • 顶次数0
  • 上传人taotao0c
  • 文件大小103 KB
  • 时间2017-09-15
最近更新