尝试创建一个类帐户,但每次构建时我都会继续“链接命令失败,退出代码为1”。任何建议都会受到高度赞赏,因为我一直试图解决这个问题几天。
#include <iostream>
using namespace std;
class Account
{
public:
Account();
Account(double input_balance);
void input();
private:
double balance;
};
Account::Account()
{
double balance = 0.0;
}
Account::Account(double input_balance)
{
double balance = input_balance;
}
void Account::input()
{
char in;
cout << "Would you like to deposit or withdraw money from your account? Enter D for deposit and W for withdraw: ";
cin >> in;
if(in == 'd' || in == 'D')
cout << "Yo";
if(in == 'w' || in == 'W')
cout << "no";
}
int main()
{
Account tyler;
tyler.input();
}