#import <Foundation/Foundation.h>
#import "Calculator.h"
#import "ctype.h"
int main(int argc, const char * argv[])
{
double value1,value2;
char operator;
Calculator *myCal =[[Calculator alloc]init ];
NSLog(@"Type in your expression");
scanf("%1f %c %1f",&value1,&operator,&value2);
[myCal setAccumulator:value1];
if (operator =='+')
[myCal add:value2];
else if (operator == '-')
[myCal subtract:value2];
else if (operator == '*')
[myCal multiply:value2];
else if (operator == '/')
[myCal divide:value2];
NSLog(@"%.2f",[myCal accumulator]);
}
return 0;
}
我找不到关于此代码的任何错误,我从书中键入代码,代码与书中的代码相同。但是xcode告诉我他们有两个错误,第一个是'预期的标识符或'('第二个是'预期的外部声明'