Guys please can you help me out there? Am still trying to find my way through programming in C, someone please help!! 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. Have to include comments throughout the code to make your code readable.
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: printf("Please enter cutting speed"); 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: printf("Please enter cutting speed"); 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'
Thank you very much gpk kishore, that was awesome will try to do as per your instruction. Thanks again!!:pleased: