

InterviewSolution
Saved Bookmarks
1. |
Solve : Wage batch file, help?? |
Answer» <html><body><p>echo off<br/>cls<br/>:hourly<br/>Set hourly=<br/>set /p hourly=Hourly wage:<br/>Set hours=<br/>set /p hours=Hours:<br/>Set days=<br/>set /p days=Days:<br/>echo Weekly should be 4.5<br/>Set weekly=<br/>set /p weekly=weeks:<br/>Set year=<br/>set year= Months worked:<br/>echo daily amount:<br/>set /a %hourly%*%hours%<br/>echo weekly amount: <br/>set /a %hourly%*%hours%*%days%<br/>echo monthly amount:<br/>set /a %hourly%*%hours%*%days%*%weekly%<br/>echo <a href="https://interviewquestions.tuteehub.com/tag/yearly-1464796" style="font-weight:bold;" target="_blank" title="Click to know more about YEARLY">YEARLY</a> amount:<br/>set /a %hourly%*%hours%*%days%*%weekly%*%year%<br/>pause<br/><br/>I'm being returned that the operators are missing. If anyone has documentation I can look at to fix this, would appreciate it.remove your echo off and run it again. You will spot your mistake easily Quote from: ghostdog74 on <a href="https://interviewquestions.tuteehub.com/tag/april-380813" style="font-weight:bold;" target="_blank" title="Click to know more about APRIL">APRIL</a> <a href="https://interviewquestions.tuteehub.com/tag/15-237501" style="font-weight:bold;" target="_blank" title="Click to know more about 15">15</a>, 2010, 05:52:27 PM</p><blockquote>remove your echo off and run it again. You will spot your mistake easily<br/></blockquote> AHEM, you didn't set a variable name with the set /a commands. Quote from: Helpmeh on April 15, 2010, 08:23:42 PM<blockquote>AHEM, you didn't set a variable name with the set /a commands. <br/></blockquote> are you <a href="https://interviewquestions.tuteehub.com/tag/replying-7280258" style="font-weight:bold;" target="_blank" title="Click to know more about REPLYING">REPLYING</a> to me or the OP ? Quote<blockquote>If you use any of the logical or modulus operators, you will need to<br/>enclose the expression string in quotes. Any non-numeric strings in the<br/>expression are treated as environment variable names whose values are<br/>converted to numbers before using them. If an environment variable name<br/>is specified but is not defined in the current environment, then a value<br/>of zero is used. This allows you to do arithmetic with environment<br/>variable values without having to type all those % signs to get their<br/>values. If SET /A is executed from the command line outside of a<br/>command script, then it displays the final value of the expression. The<br/>assignment operator requires an environment variable name to the left of<br/>the assignment operator. Numeric values are decimal numbers...<br/> </blockquote> Also, the % is used as an operator. So use of the % when using SET /A will generate an <a href="https://interviewquestions.tuteehub.com/tag/error-25548" style="font-weight:bold;" target="_blank" title="Click to know more about ERROR">ERROR</a> if there is no operand to go with it. <br/><br/>Or to put it simply, take out those % things unless you really want them.<br/><br/> Quote from: ghostdog74 on April 15, 2010, 09:05:09 PM<blockquote>are you replying to me or the OP ?<br/></blockquote> OP. Quote from: ghostdog74 on April 15, 2010, 05:52:27 PM<blockquote>remove your echo off and run it again. You will spot your mistake easily<br/></blockquote> <br/>was fixed here, sorry lost the url for the post. thank you everyone =]</body></html> | |