#include <iostream>
#include <fstream>
using namespace std;
int information1(int hourR);
int information2(int conTime);
int intformation3(int income1);
int hourR,conTime,income1;
ofstream outfile;
int main()
{
int hours,consultTime,income,fortyPercent,seventyPercent;
outfile.open("Billing amount.txt");
hours=information1(hourR);
consultTime=information2(conTime);
income=information3(income1);
if((income<=25000)&&(consultTime<=30))
{
outfile<<"No charges";
}
else if((income>=25000)&&(consultTime>=30))
{
fortyPercent=hours*.4;
outfile<<fortyPercent;
}
if(consultTime<=20)
{
outfile<<"No charges";
}
else if(consultTime>20)
{
seventyPercent=hours*.7;
outfile<<seventyPercent;
}
outfile.close();
return 0;
}
int information1(int hourR)
{
cout<<"Enter hourly rate.";
cin>>hourR;
return hourR;
}
int information2(int conTime)
{
cout<<"Enter total consulting time";
cin>>conTime;
return conTime;
}
int intformation3(int income1)
{
cout<<"Enter income.";
cin>>income1;
return income1;
}
编译器说 information3 没有在这个范围内声明。但是当我声明它时,编译器说我不能使用它。该程序可能存在更多问题,但截至目前我被困在这部分。谢谢您的帮助。