C++ 用C+编写存款方法+;,有麻烦
我正在编写一个方法,它接受存款金额的值作为参数。如果金额大于余额,账户将用新金额更新。否则,它将返回旧bal并退出。这是我的密码:C++ 用C+编写存款方法+;,有麻烦,c++,xcode,methods,C++,Xcode,Methods,我正在编写一个方法,它接受存款金额的值作为参数。如果金额大于余额,账户将用新金额更新。否则,它将返回旧bal并退出。这是我的密码: double withdraw(double amount) { if((bal-amount)<0) { throw new Exception ("There were insufficient funds"); else bal=bal-amount;
double withdraw(double amount)
{
if((bal-amount)<0)
{
throw new Exception
("There were insufficient funds");
else
bal=bal-amount;
return bal;
}
}
双倍取款(双倍金额)
{
如果((余额金额)您将{}
放错了位置
double withdraw(double amount)
{
if((bal-amount)<0)
{
throw new Exception("There were insufficient funds");
}
else
{
bal=bal-amount;
}
return bal;
}
双倍取款(双倍金额)
{
如果((余额)啊,是的,我现在看到了。