复杂计算(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. ...
-
word-word word cron-jobs of off-wordpress file(wordpress cron-jobs of off-wordpress file)[2022-09-19]
通过在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 Jobs停止了工作(Cron Jobs stopped working)[2024-01-01]
好吧,我最终联系了我的托管支持。 结果是域被移动到一个新的服务器,而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. -
Wordpress PHP Cron工作(Wordpress PHP Cron jobs)[2023-07-30]
您必须包含2个文件才能访问管理员端功能:首先,wp-load.php。 wp-load.php可以设置所有内容,然后激活wordpress。 但是,您正在内容目录中的插件文件夹(而不是管理目录)中调用此函数 - 所以当调用wp-load时,您不会进入管理部分,也不会访问这些功能。 好的一面是,您也无需处理WordPress强制您登录。 由于您仍需要这些管理功能,请包含wp-admin / admin-functions.php。 这会加载管理员端并让您访问管理功能 - 然后您就可以开始使用了 You’ve ... -
使用PHP的CRON Jobs(CRON Jobs with PHP)[2022-01-22]
有时在共享主机上执行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 ...