函数未在此范围内声明

时间:2013-10-28 15:16:01

标签: c++

#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。但是当我确实声明它时,编译器说我无法使用它。这个程序可能会有更多问题,但截至目前我仍然坚持这一部分。谢谢你的帮助。

1 个答案:

答案 0 :(得分:4)

发现差异

int intformation3(int income1);
      ^

income=information3(income1);