-2

一直在想我下面的代码有什么问题。所有方法声明都被 XCODE 引用为错误。它说预期“;” 在声明列表的末尾。我会很感激你的帮助。谢谢 :)

    @interface
    Budget : NSObject{

float exchangeRate;
double budget;
double exchangeTransaction;


- (void) createBudget: (double) aBudget withExchangeRate: (float) anExchangeRate;
- (void) spendDollarts: (double) dollars ;
- (void) changeForeignCurrency: (double) foreignCurrency ;
    }
    @end




    int main(int argc, const char * argv[])
    {
         NSLog(@"Run Without error");
         return 0;
    }
4

1 回答 1

5

你有一个}错误的地方。它必须紧随其后exchangeTransaction。例子:

@interface Budget : NSObject 
{
    float exchangeRate;
    double budget;
    double exchangeTransaction;
}

- (void)createBudget:(double)aBudget withExchangeRate:(float)anExchangeRate;
- (void)spendDollars:(double)dollars;
- (void)changeForeignCurrency:(double)foreignCurrency;

@end
于 2013-04-16T04:57:16.837 回答