jeudi 4 juillet 2019

input was not declared in this scope ( line 41 )

#include <iostream>
using namespace std;

void menue()
{

    cout<<"Choose an option"<<endl;
    cout<<"========================"<<endl;
    cout<<"1.  Open"<<endl;
    cout<<"1.  Close"<<endl;
    cout<<"1.  Exit"<<endl;

}

void menueOptions()
{

    do
    {
        int input;
        cout<<"Enter selection here:  "<<flush;
        cin >> input;

        switch(input)
        {

        case 1:
            cout<<"Opening..."<<endl;
            break;
        case 2:
            cout<<"Closing..."<<endl;
            break;
        case 3:
            cout<<"Exiting..."<<endl;
            break;
        default:
            cout<<"Invalid input"<<endl;

        }
    }
while(input < 1 || input > 3); // ERROR HERE (INPUT WAS NOT DECLARED IN THIS // SCOPE)
}

int main()
{

    menue();
    menueOptions();


return 0;
}

Aucun commentaire:

Enregistrer un commentaire