Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return statement #Issue_1 #1

Closed
Brainhub24 opened this issue May 11, 2023 · 1 comment
Closed

Return statement #Issue_1 #1

Brainhub24 opened this issue May 11, 2023 · 1 comment
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Brainhub24
Copy link
Owner

#Issue 1 | Warning messages
The compiler that indicate that your functions Deposit(), Withdraw(), Balance(), and Payment() do not have a return statement, even though they are declared to return an int type.

student@DESKTOP-VPCG4P6:/mnt/c/Users/Student/Downloads$ g++ -o atm ATM.cpp
ATM.cpp: In function ‘int Deposit()’:
ATM.cpp:21:1: warning: no return statement in function returning non-void [-Wreturn-type]
21 | }
| ^
ATM.cpp: In function ‘int Withdraw()’:
ATM.cpp:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
41 | }
| ^
ATM.cpp: In function ‘int Balance()’:
ATM.cpp:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
49 | }
| ^
ATM.cpp: In function ‘int Payment()’:
ATM.cpp:78:1: warning: no return statement in function returning non-void [-Wreturn-type]
78 | }
| ^

@Brainhub24 Brainhub24 self-assigned this May 11, 2023
@Brainhub24 Brainhub24 added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels May 11, 2023
@Brainhub24
Copy link
Owner Author

Brainhub24 commented May 11, 2023

Fixed issue - #1

Added a return statement at the end of each function.

int Deposit()
{
    int Deposit;

    cout << "*****How much do you want to Deposit : *****"<< endl;
    cin >> Deposit;

    money = money + Deposit;

    cout << "_____Now Balance is_____= " << money << endl;

    return money;
}

int Withdraw()
{
    int Withdraw;

    cout << "*****How much do you want to Withdraw*****:" << endl;
    cin >> Withdraw;

    money = money - Withdraw;

    if (money < 0) {
        cout << " Something went wrong . " << endl;
    }

    cout << "_____Now Balance is_____= " << money << endl;

    return money;
}

int Balance()
{
    cout << "_____Your Balance is_____= " << money << endl;

    return money;
}

int Payment()
{
    int Payment;
    string Bank;
    int num;

    cout << "*****Which Bank ? *****:" << endl;
    cin >> Bank;

    cout << "*****Please enter the number of bank account*****:" << endl;
    cin >> num;

    cout << "*****How much do you want do Payment*****:" << endl;
    cin >> Payment;

    money = money - Payment;

    if (money < 0) {
        cout << " Something went wrong  . " << endl;
    }

    cout << "_____Now Balance is_____= " << money << endl;

    return money;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant