У меня чертовски время, чтобы этот код правильно встряхнулся. Я сейчас застрял в последней строке текста. Я новичок в написании кода. Все, что я узнал, было найдено в Интернете и через этот сайт. См. Подчеркнутые примечания ниже. Пожалуйста, помогите, чтобы я мог увидеть, если мой расчет даже работает ...Комплексный расчет
//.h
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *Price87;
@property (weak, nonatomic) IBOutlet UITextField *MPG87;
@property (weak, nonatomic) IBOutlet UITextField *PriceE85;
@property (weak, nonatomic) IBOutlet UITextField *MPGE85;
@property (weak, nonatomic) IBOutlet UITextField *GasTankSize;
- (IBAction)Settings:(id)sender;
- (IBAction)pergallon:(id)sender;
- (IBAction)pertank:(id)sender;
@end
//.m
#import "ViewController.h"
@interface ViewController()
@end
@implementation ViewController <----------- Getting a Incomplete Implementation here...
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)Settings:(id)sender {
Settings *settings = [[Settings alloc] initWithNibName:nil bundle:nil];
[self presentViewController:settings animated:YES completion:NULL];
}
- (IBAction)addNums:(id)sender {
int a = ([_Price87.text floatValue]);
int b = ([_MPG87.text floatValue]);
int c = ([_PriceE85.text floatValue]);
int d = ([_MPGE85.text floatValue]);
int e = ([_GasTankSize.text floatValue]);
int ans = ((a*e)-((e+(a*e)-(c*e)/b)*d)/e);
[ans setText:[NSString stringWithFormat:@"%i", pergallon]]; <--------- This is the line giving me trouble. I'm getting a "use of undeclaired identifier 'pergallon'
}
@end
'pergallon' метод, а не переменная в области метода addNums. – CodaFi