为什么我的程序不能输出?
#include<iostream>#include<string>
#include<fstream>
#include<iomanip>
using namespace std;
float culcuate_time(float START_HOURS, float END_HOURS, float END_MINUTES, float START_MINUTES);
float figure_pay(float TOTAL, float PAY_RATE) ;
bool vildate_times(float START_HOURS, float END_HOURS, float END_MINUTES, float START_MINUTES);
int main()
{
char TIME1 , TIME2;
float PAY_RATE, TOTAL, OVERTIME,PAYCHECK;
bool result;
float START_HOURS, START_MINUTES,
END_HOURS,END_MINUTES;
char k ;
string datatime1, datatime2,datatime3;
string WORKNAME;
ifstream inFile;
string Filename;
cout<<"Time Clock Program"<<endl
<<"Enter the filename of data to proces"<<endl;
cin>>Filename;
if (!inFile)
{
cout<<"Sorry, that file does not exist! "<<'\a';
return 0;
}
inFile.open("Filename.txt");
getline(inFile,WORKNAME)>>START_HOURS>>k>>START_MINUTES
>>TIME1>>END_HOURS>>k>>END_MINUTES
>>TIME2>>PAY_RATE;
cout<<"Name : "<<WORKNAME<<endl
<<"Start TIME : "<<START_HOURS<<k<<START_MINUTES<<TIME1<<endl
<<"End Time : "<<END_HOURS<<k<<END_MINUTES<<TIME2<<endl
<<"Payrate : "<<PAY_RATE;
result=vildate_times( START_HOURS, END_HOURS, END_MINUTES, START_MINUTES);
if (result==false)
cout<<"Invalid time! Time set to 0:00"<<endl
<<"Invalid time! Time set to 0:00"<<endl
<<"Employee"<< WORKNAME<<"has worked 0.00 hours"
<<endl
<<endl
<<"No overtime"<<endl
<<"The paycheck is for $0.00";
else
{
TOTAL=culcuate_time(START_HOURS, END_HOURS, END_MINUTES, START_MINUTES);
if(0<TOTAL && TOTAL<8)
{
PAYCHECK=figure_pay(TOTAL, PAY_RATE);
cout<<"Employee "<<WORKNAME<<" has worked "<<TOTAL<<" hours "<<endl;
cout<<"No Overtime!"<<endl;
cout<<"The paycheck is for"<<PAYCHECK;
}
else
{
TOTAL=culcuate_time(START_HOURS, END_HOURS, END_MINUTES, START_MINUTES);
PAYCHECK=figure_pay(TOTAL, PAY_RATE);
cout<<"OVERTIME!!"<<endl
<<TOTAL-8<<" hours overtime"<<endl
<<"The paycheck is for "<<PAYCHECK<<endl;
}
}
system("pause");
return 0;
}
bool vildate_times(float START_HOURS, float END_HOURS, float END_MINUTES, float START_MINUTES)
{
bool result;
if(0<=START_MINUTES&& START_MINUTES<=59 && 0<=END_MINUTES && END_MINUTES<=59 && 0<START_HOURS &&START_HOURS<=12 && 0<END_HOURS
&&END_HOURS<=12)
{
char TIME1, TIME2;
if(TIME1==TIME2 && START_HOURS<END_HOURS || TIME1=='A' && TIME2=='P')
result=true;
else
result=false;
}
else
result=false;
return result;
}
float culcuate_time(float START_HOURS, float END_HOURS, float END_MINUTES, float START_MINUTES)
{
float TOTAL;
char TIME1, TIME2;
if(TIME1==TIME2)
TOTAL=(END_HOURS-START_HOURS)+(END_MINUTES-START_MINUTES)/60;
else
TOTAL=(END_HOURS+12-START_HOURS)+(END_MINUTES-START_MINUTES)/60;
return TOTAL;
}
float figure_pay(float TOTAL , float PAY_RATE)
{
float PAYCHECK;
if (TOTAL>8)
{
const float OVERTIME=TOTAL-8;
PAYCHECK=(OVERTIME*1.5+TOTAL)*PAY_RATE;
}
else
PAYCHECK=TOTAL*8;
return PAYCHECK;
}