# Programming in C

Discussion in 'C' started by absmaf, Oct 10, 2011.

1. ### absmafNew Member

Joined:
Oct 10, 2011
Messages:
2
0
Trophy Points:
0

How do I write a program in C to calculate the maximum tool life for a given tool using Taylor's equation: VcT^n =C,
where Vc is the cutting spped; T is the tool life and n and C are constants.
The constants n= 0.125 and C = 59.5

1. when the program is run, a menu should be displayed on the screen with two options (a) calculate tool life and (b) exit from the program
2. if the user selects input (a), ask the user to input cutting speed (V); else exit()
3. calculate tool life by using formula: (59.5/V)^(1/0.125)
4. display result on the screen and go back to main menu.
5. repeat this as long as option (b) is not selected.

2. ### gpk kishoreNew Member

Joined:
Jun 30, 2011
Messages:
82
0
Trophy Points:
0
Code:
```/*program for Taylor's equation*/
/* V*pow(T,n)=C */
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
void main()
{
float n=0.125,C=59.5,V,T;
int x;
clrscr();
do
{
printf("Enter 1 for calculating	tool life and 2 for exit");
scanf("%d",&x);
switch(x)
{
case 1:
scanf("%f",&V);
T=pow(C/V,1/n);
printf("Tool life=%f",T);
printf("\n");
break;
case 2:exit(0);
}
}while(x<=2);
getch();
}/*program for Taylor's equation*/
/* V*pow(T,n)=C */
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
void main()
{
float n=0.125,C=59.5,V,T;
int x;
clrscr();
do
{
printf("Enter 1 for calculating	tool life and 2 for exit");
scanf("%d",&x);
switch(x)
{
case 1:
scanf("%f",&V);
T=pow(C/V,1/n);
printf("Tool life=%f",T);
printf("\n");
break;
case 2:exit(0);
}
}while(x<=2);
getch();
}```
If you want for further higher values then use 'double ' instead of 'float'

Joined:
Oct 10, 2011
Messages:
2