Solved

desimal math problem

Posted on 1997-06-11
1
186 Views
Last Modified: 2010-04-06
using a math problems to caoculate Speeds and Feeds on CNC machines.  Basic program tried

var
  A, B                 :String[6];
  N1,D1,X1, Ans, Ans1  :????; {used Integer and Real}
begin
  N1:=300.0
  D1:=1.500
  X1:=3.82
  Ans:=X+1N+1D1);
  Ans1:=3.82+1.5+300.0
  Str(ans,A);
  Str(Ans1,B);
  Label1.Caption:=A;
  Label2.caption:=B;

When I used these I got the correct answer for B and an off the wall answer for A

The two formulas I'm trying to use are

  RPM=FPM( Drill Size / material type)
      3.82   .500         300

  IPM= RPM X Dia.
             
Please have a sample of the code.  I get more out of looking at code than reading text and manuals..            
0
Comment
Question by:jim zerbe
1 Comment
 
LVL 3

Accepted Solution

by:
hpierson earned 50 total points
ID: 1336976
I actually went to the trouble of typing in your program, and running it (using the type real). It worked perfectly after I corrected your typos, in particular:

ans := X1 + N1 + D1;

and putting semi colons at the end of each statement.

Look at your code carefully. The first time I type this, I left out the above line, and since this left ans undefined (and filled with garbage), when I converted from real to string, I got off the wall garbage...<g>
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question