1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Programming in C

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

  1. absmaf

    absmaf New Member

    Joined:
    Oct 10, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  2. gpk kishore

    gpk kishore New Member

    Joined:
    Jun 30, 2011
    Messages:
    82
    Likes Received:
    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:
    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'
     
  3. absmaf

    absmaf New Member

    Joined:
    Oct 10, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Thank you very much gpk kishore, that was awesome will try to do as per your instruction. Thanks again!!:pleased:
     

Share This Page