algo/object-c/08_stack/stack_practice/main.m
2018-10-09 17:13:17 +08:00

21 lines
800 B
Objective-C

#import <Foundation/Foundation.h>
#import "FourOperation.h"
#import "BalancedParentheses.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
// 测试四则运算
NSNumber *a = [[FourOperation shared] caculateExpression:@"10 - 4 / 2 * 3 + 3 - 6 / 2"];
NSNumber *b = [[FourOperation shared] caculateExpression:@"10 - 3"];
NSNumber *c = [[FourOperation shared] caculateExpression:@"2 * 3"];
NSLog(@"FourOperation: %ld\t%ld\t%ld\t", a.integerValue, b.integerValue, c.integerValue);
// 测试括号匹配
BalancedParentheses *balancedCheck = [BalancedParentheses new];
BOOL result = [balancedCheck checkForParenthessBlanced:@"([{{{}}}])"];
NSLog(@"BalancedParentheses: %d", result);
}
return 0;
}