Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

desimal math problem

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
jim zerbe
Asked:
jim zerbe
1 Solution
 
hpiersonCommented:
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now