mardi 25 juin 2019

How to Call a Function Without Initializing it Before other one C++

My Problem here is that i have initialized a function mainscr() which on a condition call vdetails(). but as the code is shown below the program doesn't compile because of either of the functions is not initialized before the other. If i keep mainscr() on top of vdetails() mainscr will not run but vdetails() will because mainscr() is initialized before. Can anyone suggest me on how i can declare the function as to be used from anywhere.

Tried using Header file in which already vdetails() is included but getting error like include nested too deep.

void mainscr()
{
    stringstream foos (detamt);
    foos >> detamto;
    char flago;
    cout<<"Welcome To Maxon Bank Banking Portal"<<endl<<endl;
    cout<<"  Please Choose From the Following: "<<endl<<endl;
    cout<<"  1. View Details "<<endl<<endl; cout<<"  2. Check Balance"<<endl<<endl;
    cout<<"  3. Deposit Cash "<<endl<<endl; cout<<"  4. Withdraw Cash "<<endl<<endl;
    cout<<"  Option: ";
    cin>>flago;
    if (flago=='1')
    {
        vdetails();
    }

void vdetails()
{
   system("cls");
        cout<<"Maxon Bank Banking Portal"<<endl<<endl;
        cout<<"  "<<detacno<<endl<<endl;
        cout<<"  "<<detn<<endl<<endl;
        cout<<"  "<<detactype<<endl<<endl;
        cout<<"  AVAILABLE BALANCE: INR "<<detamto<<endl<<endl;
        Cont();
        system("cls");
        mainscr();
}

Actually i am trying to ask user their input if input is 1 then that will show them their account details and go back to mainscr() where this thing will happen again if input is same.

Aucun commentaire:

Enregistrer un commentaire