Question and Answers

EliteForce Can anybody tell me what is wrong with this code? - EliteForce I am using Delphi to do some programing. I am creating a "Console Application" I have written up a code: program Calc; {$APPTYPE CONSOLE} var boars,minutes : integer; begin { TODO -oUser -cConsole Main : Insert code here } writeln(' This program Calculates the amount of Boars killed...' ); writeln( 'Please Enter the amount of minutes played' ); readln(minutes); boars := minutes // 4; writeln('The amount of boars killed is',boars); readln; end. When ever I click F9, to run the application, Delphi selects the following line in red, to represent an error: writeln('The amount of boars killed is',boars); I am not sure what the error is, so can anybody please help me. Thanks in advance.
Best Answer: boars := minutes div 4; writeln('The amount of boars killed is ' + IntToStr(boars)); boars are integer, need to convert to string/pchar before output. also better to use div instead of /, because if minutes will be 9, so 9/4 will have float output and program will break with an error. - Randy

Best Answers are selected by the person who asked the question or other Yahoo! users. Find out more at Yahoo! Answers.

Enter a keyword below to find questions and answers from real people.

Want to ask a question? Go to Yahoo! Answers

Product Categories

Computers Home Office Wi-Fi & Networking Phones & PDAs Cameras & Camcorders TV & Home Theater Portable Audio

My Tech

Please enable your browser's cookies to activate the My Tech column.


Question and Answer content at Yahoo! Tech is written by Yahoo! users at Yahoo! Answers. Yahoo! does not evaluate or guarantee the accuracy of any Yahoo! Answers content. For more information, read the Full Disclaimer.

Opinions expressed by the Advisors are their own and do not necessarily reflect the views of Yahoo! Inc. Yahoo! receives no compensation from any manufacturer or distributor nor does it compensate any Advisor for the coverage of any product or service in any Advisor's content.