资源简介
我的课程设计,保证可以使用。不懂得可以在后面留言
宿舍
代码片段和文件信息
#include “checkin.h“
#include “ui_checkin.h“
#include“room.h“
#include“information.h“
#include
#include
#include
CheckIn::CheckIn(QWidget *parent) :
QDialog(parent)
ui(new Ui::CheckIn)
{
ui->setupUi(this);
}
CheckIn::~CheckIn()
{
delete ui;
}
void CheckIn::on_pushButton_clicked()
{
int num=0;
QFile filein(“/home/in.txt“);
QString* data =new QString[100];
if(!filein.open(QIODevice::ReadOnly|QIODevice::Text))
{
qDebug()<<“OPen file failed“;
}
else{
while(!filein.atEnd())
{
if(num<100)
data[num]=filein.readLine();
qDebug()< num++;
}
for(int i=0;i {
QString data_temp=data[i].trimmed();
QStringList data_buf =data_temp.split(“|“);
r1[i].chgprice(data_buf[1].toInt());
r1[i].chgstate(data_buf[2]);
r1[i].chgrudate(data_buf[3]);
r1[i].chgtime(data_buf[4].toInt());
}
}//read
filein.close();
int a;
for(int i=0;i<3;i++)
{
a=i;
if(r1[i].getroomnum()==ui->romnum->text().toInt())
{
break ;
}
}
if(r1[a].getstate()==“已被预订“||r1[a].getstate()==“已入住“)
QMessageBox::warning(this “warning““the room not freeplease choose again“QMessageBox::Yes);
r1[a].chgstate(“已入住“);
r1[a].chgrudate(ui->rudate->text());
r1[a].chgtime(ui->time->text().toInt());
r1[a].addTelnum(ui->Telnum->text());//do
QFile file(“/home/in.txt“);
if(!file.open((QIODevice::WriteOnly|QIODevice::Text)))
{
qDebug()<<“open file failure“;
}
QTextStream outdata(&file);
for(int i=0;i<3;i++)
{
QString temp =““;
QString temp1=QString::number(r1[i].getroomnum()10);
QString temp2=QString::number(r1[i].getprice()10 );
QString temp3=QString::number(r1[i].gettime()10 );
temp+=temp1;
temp+=“|“;
temp+=temp2;
temp+=“|“;
temp+=r1[i].getstate();
temp+=“|“;
temp+=r1[i].getrudate();
temp+=“|“;
temp+=temp3;
temp+=“|“;
temp+=“\n“;
outdata<< temp;
}
file.close();//write
int num1=0;
QFile filein2(“/home/in2.txt“);
QString* data2 =new QString[100];
if(!filein2.open(QIODevice::ReadOnly|QIODevice::Text))
{
qDebug()<<“OPen file failed“;
}
else{
while(!filein2.atEnd())
{
if(num1<100)
data2[num1]=filein2.readLine();
qDebug()< num1++;
}
for(int i=0;i {
QString data_temp=data2[i].trimmed();
QStringList data_buf =data_temp.split(“|“);
m1[i].chgname(data_buf[0]);
m1[i].chgsex(data_buf[1]);
m1[i].chgIDnum(data_buf[2]);
m1[i].chgroomnum(data_buf[3].toInt());
m1[i].chgTelnum(data_buf[4]);
m1[i].chgrudate(data_buf[5]);
m1[i].chgtime(data_buf[6].toInt());
m1[i].chgprice(data_buf[7].toInt());
m1[i].chgfirstprice(data_buf[8].toInt());
}
}//read information
int b;
for(int i=0;i<1
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 324 2016-06-06 09:27 dormitory\checkin.h
....... 1617 2016-06-06 15:38 dormitory\information.h
....... 509 2016-06-05 16:28 dormitory\mainwindow.h
....... 608 2016-06-06 17:50 dormitory\manager.h
....... 1187 2016-06-06 12:14 dormitory\room.h
....... 465 2016-06-06 09:07 dormitory\user.h
....... 4404 2016-06-06 17:04 dormitory\checkin.cpp
....... 2290 2016-06-06 15:44 dormitory\main.cpp
....... 1510 2016-06-06 15:38 dormitory\mainwindow.cpp
....... 13232 2016-06-06 17:56 dormitory\manager.cpp
....... 3 2016-06-05 00:07 dormitory\room.cpp
....... 7648 2016-06-06 16:13 dormitory\user.cpp
....... 539 2016-06-06 12:41 dormitory\dormitory.pro
....... 5057 2016-06-06 16:13 dormitory\checkin.ui
....... 3954 2016-06-06 15:38 dormitory\mainwindow.ui
....... 9611 2016-06-06 17:50 dormitory\manager.ui
....... 6535 2016-06-05 21:04 dormitory\user.ui
....... 18316 2016-06-06 18:31 dormitory\dormitory.pro.user
目录 0 2016-06-08 13:53 dormitory
----------- --------- ---------- ----- ----
77809 19
- 上一篇:世界各国国家省市区(州市区)名字数据库
- 下一篇:简单电影数据库设计
评论
共有 条评论