Hello, I'm new here and to C++ in general. I'm working on my first program, which is basically just a simple formula we use for determining feedrates on our CNC machines.. Here is the code, I'll try to use the HTML format here.. (first try for this particular code).
Code:
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
using namespace std;
int main(int nnumberofargs, char* pszargs[])
{
int flutes, rpm;
float material, chipload, bitsize, product, converted;
cout << "Enter size of bit: ";
cin >> bitsize;
cin.ignore();
cout << "Enter size of material: ";
cin >> material;
cin.ignore();
product = material / bitsize;
converted = static_cast<int>(product);
cout << "Enter nominal chipload: ";
cin >> chipload;
cin.ignore();
if ( converted > 2 ){
chipload = chipload * 0.5;
}
if ( converted > 3 ) {
chipload = chipload * 0.33;
}
if ( converted > 4 ) {
chipload = chipload * 0.25;
}
if ( converted > 5 ) {
chipload = chipload * 0.125;
}
cout << "Enter number of flutes: ";
cin >> flutes;
cin.ignore();
cout << "Enter desired RPM: ";
cin >> rpm;
cin.ignore();
cout << "Your maximum feedrate is: " << flutes * rpm * chipload << endl;
system("pause");
return 0;
}
I know there is alot of garbage in there, since I used a template from some other program and have tried several things that I got from online. Basically I need to either turn the PRODUCT symbol into an interger, or get tricky with the IF statements. The final product is this formula:
If your nominal chipload is .02, and you are using a 1/2" bit to go through 1.125" material, then the chipload must be reduced by 50% (actually, it is bit diameter/board thickness = percentage to reduce chipload)
thanks!
Zzaacchh