C ++与'operator ='不匹配(后缀为中缀)

时间:2016-03-14 05:10:38

标签: c++

我正在编写将postfix转换为中缀的程序。 我设法编写一个相反的程序,但是当我尝试创建这个特定的程序时,我遇到了许多问题,我无法真正理解我做错了什么。

以下是我的计划: 我无法编译。在我看来,这是一个简单的问题,但我无法弄清楚这个问题。

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.


MKCoordinateRegion place1 = { {0.0, 0.0} , {0.0, 0.0} };
place1.center.latitude = 34.7037755;
place1.center.longitude = 137.7345882;
place1.span.longitudeDelta = 0.02f;
place1.span.latitudeDelta = 0.02f;
[mapView setRegion:place1 animated:YES];

Newclass *ann1 = [[Newclass alloc] init];
ann1.title = @"Place1";
ann1.subtitle = @"subtitle";
ann1.coordinate = place1.center;
[mapView addAnnotation: ann1];

MKCoordinateRegion place2 = { {0.0, 0.0} , {0.0, 0.0} };
place2.center.latitude = 34.7024461;
place2.center.longitude = 137.7297572;
place2.span.longitudeDelta = 0.02f;
place2.span.latitudeDelta = 0.02f;
[mapView setRegion:place2 animated:YES];

Newclass *ann2 = [[Newclass alloc] init];
ann2.title = @"place2";
ann2.subtitle = @"subtitle";
ann2.coordinate = place2.center;
[mapView addAnnotation:ann2];


}

-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation{
MKPinAnnotationView *myPin = [[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:@"current"];
myPin.pinColor = MKPinAnnotationColorGreen;

UIButton *advertButtom = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[advertButtom addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];

myPin.rightCalloutAccessoryView = advertButtom;
myPin.draggable =NO;
myPin.animatesDrop =true;
myPin.canShowCallout=YES;

return myPin;

}

-(void)button:(id)sender{
NSUserDefaults *defults = [NSUserDefaults standardUserDefaults];
UIStoryboard *storyboard = [self storyboard];
descriptionViewController *description = [storyboard instantiateViewControllerWithIdentifier:@"des"];
[self presentModalViewController:description animated:YES];


NSLog(@"touched");
NSLog(@"data %@");
}

1 个答案:

答案 0 :(得分:2)

就像本杰明所说,pop返回无效。因此,无法将字符串设置为void。要解决此问题,请将其设置为等于顶部元素,然后将其弹出。

output += stk.top();
stk.pop();