Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 用C+编写存款方法+;,有麻烦_C++_Xcode_Methods - Fatal编程技术网

C++ 用C+编写存款方法+;,有麻烦

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;

我正在编写一个方法,它接受存款金额的值作为参数。如果金额大于余额,账户将用新金额更新。否则,它将返回旧bal并退出。这是我的密码:

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;
}
双倍取款(双倍金额)
{

如果((余额)啊,是的,我现在看到了。