首页 \ 问答 \ 复杂计算(Complex Calculation)

复杂计算(Complex Calculation)

我有一段时间让这段代码正确地摆脱出来。 我目前卡在最后一行文字中。 我是新手一起编写代码。 我所学到的一切都是通过网站和网站找到的。 请参阅下面带下划线的注释。 请帮助,以便我可以看到我的计算是否有效......

//.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

I'm having a heck of a time getting this code to shake out correctly. I'm currently stuck at the very last line of text. I'm new to writing code all together. Everything I've learned has been found online and through this site. Please see the underlined notes below. Please help so i can see if my calculation even works...

//.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

原文:https://stackoverflow.com/questions/17416598
更新时间:2022-06-05 06:06

最满意答案

iSIUE固定在我的eDIT上。


This is how I fixed it:

$mymethod = $_SERVER['argv'];
$arrmethod = $mymethod[1];
parse_str($arrmethod);
echo $method;

相关问答

更多
  • 将工作目录更改为正在运行的文件路径。 只需使用 chdir(dirname(__FILE__)); include_once '../your_file_name.php'; //we can use relative path after changing directory 在正在运行的文件中。 那么您将不需要将所有相对路径更改为每个页面中的绝对路径。 The working directory of the script may be different when run from a cron. ...
  • 通过在cron作业中使用CURL解决了这个问题。 Solved it by using CURL in the cron jobs.
  • 根据我的经验,我正在使用窗口任务调度程序,我每小时聚合大约70,000多条记录。 首先,如果您正在使用WAMP,请在您的测试文件夹下创建名为index.php的文件 接下来转到命令提示符并尝试执行以下操作: C:\WAMP\bin\php\php5.4.1.2\php.exe -f "C:\WAMP\www\test\index.php" 如果输出相同,我们就走在正确的轨道上,继续...... 在Windows 7中,转到“开始”菜单 ...
  • 可悲的是,cron无法在页面上执行javascript。 但是,既然你说你需要建议,你可能想看看PHP的cURL。 您可以使用cURL访问PHP中的其他网站。 你可以用它做很多协议,你需要的是GET 。 一个例子就是在这个网站上 。 // Get cURL resource $curl = curl_init(); // Set some options - we are passing in a useragent too here curl_setopt_array($curl, array( ...
  • iSIUE固定在我的eDIT上。 This is how I fixed it: $mymethod = $_SERVER['argv']; $arrmethod = $mymethod[1]; parse_str($arrmethod); echo $method;
  • $argv[0]始终包含脚本文件的名称,因为它传递给PHP二进制文件。 根据截图, $argv[1]是'33', $argv[2]是'开'。 您可以轻松检查: echo $argv[1]; 或者您可以通过以下方式将所有参数列为数组: var_dump($argv); 基本上,通过Plesk安排时,以下任务将添加到crontab中: /usr/bin/php5 -f '/test.php' -- '33' 'On' 如果test.php包含提到的命令,其执行结果如下: # cat /test.php < ...
  • 考虑在/ var / log / syslog中检查日志中的cron 还请确保您可以实际写入文件/目录(chmod权限)。 进一步确保crontab userlevel也可以写入文件/目录。 我只是尝试了你的文件,它确实对我来说执行得很好,会尝试以与你相同的方式将其作为crontab int。 编辑:把它作为一个cronjob,并运作良好,不知道是什么问题! Apparently crond wasn't running.... #service crond restart Stopping crond: ...
  • 好吧,我最终联系了我的托管支持。 结果是域被移动到一个新的服务器,而cron作业仍然在旧服务器上运行。 Well, I wound up contacting my hosting support. Turns out the domain was moved to a new server and the cron jobs were still running on the old one.
  • 您必须包含2个文件才能访问管理员端功能:首先,wp-load.php。 wp-load.php可以设置所有内容,然后激活wordpress。 但是,您正在内容目录中的插件文件夹(而不是管理目录)中调用此函数 - 所以当调用wp-load时,您不会进入管理部分,也不会访问这些功能。 好的一面是,您也无需处理WordPress强制您登录。 由于您仍需要这些管理功能,请包含wp-admin / admin-functions.php。 这会加载管理员端并让您访问管理功能 - 然后您就可以开始使用了 You’ve ...
  • 有时在共享主机上执行php cli。 尝试通过网络服务器执行您的脚本。 在cron中使用curl: /bin/curl http://www.yourdomain.com/cron.php 或者使用wget: /bin/wget -O - http://www.yourdomain.com/cron.php 让cron向您发送错误消息。 Sometimes executing php cli is not allowed on shared hosting. Try to execute your sc ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)