我收到以下代码的此错误消息,但它根本没有意义。你能检查一下这段代码并告诉你有什么问题吗?已在相关行注释了代码。
#import <Foundation/Foundation.h>
typedef struct {
float exchangeRate;
double budget;
double euroTransaction;
} budget;
int main(int argc, const char * argv[])
{
budget vacationBudget;
void spendDollars (double dollars) { //Expected ';' at end of declaration
vacationBudget.budget -= 100;
}
void chargeEuros(double euros) {
vacationBudget.euroTransaction = euros*vacationBudget.exchangeRate;
vacationBudget.budget -= vacationBudget.euroTransaction;
}
vacationBudget.exchangeRate = 1.2500;
vacationBudget.budget = 1000.00;
double numberDollars = 100;
double numberEuros = 100;
spendDollars(numberDollars);
NSLog(@"Converting %.2f US dollars into euros leaves $%.2f", numberDollars, vacationBudget.budget);
NSLog(@"Charging %.2f euros leaves $%.2f", numberEuros, vacationBudget.budget);
return 0;
}