有没有办法解决这些错误?

时间:2020-04-09 16:20:31

标签: c++ build-error

我遇到两个错误:

在函数“ int_cdecl invoke_main(void)”(?invoke_main @@ YAHXZ)中引用的未解析的外部符号_main

1个未解决的外部因素

尝试重组正在使用的ATM之后,我完全陷入困境。

#include <iostream>
#include <string>
using namespace std;

int option;
int fundsToWithdraw;
int additionalTransaction;

float balance = 1000;

void print_menu(void) {
    cout << "1. Withdrawal Funds/n" << endl;
    cout << "2. Check Balance/n" << endl;
    cout << "3. Account Details/n" << endl;
    cout << "4. Exit" << endl;
    cin >> option;
}

void menu() {
    switch (option) {

    case 1:
        cout << "Enter amount to withdraw: £ ";
        cin >> fundsToWithdraw;

        if (fundsToWithdraw > balance) {
            cout << "Insuffient Funds";
            cout << "\n\n Do you want another transaction?\nPress 1 to continue";
            cin >> additionalTransaction;

            if (additionalTransaction == 1) {
                print_menu();
            }
        }
        else {
            balance = balance - fundsToWithdraw;
            cout << "Withdraw £" << fundsToWithdraw << "Your balance after withdrawal: £" << balance;
            cout << "\n\n Do you want another transaction?\nPress 1 to continue, ";
            cin >> additionalTransaction;

            if (additionalTransaction == 1) {
                print_menu();
            }
        }

        int main(); {

        }



    }
}

0 个答案:

没有答案