Like Tree1Likes
  • 1 Post By Adak

Error Help

This is a discussion on Error Help within the C Programming forums, part of the General Programming Boards category; Code: #include <stdio.h>double washerWeight(double,double,double);//prototype double circleArea(double,double);//prototype //void printWeights int main(void) { double quant,thick,dens,innerd,outerd,circleA1,weight1; printf("Enter quantity,thickness,density,inner diameter,outer diameter of Washer Type ...

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    6

    Error Help

    Code:
    #include <stdio.h>double washerWeight(double,double,double);//prototype
    double circleArea(double,double);//prototype
    //void printWeights
    int main(void)
    {
    
    
    double quant,thick,dens,innerd,outerd,circleA1,weight1;
        
        printf("Enter quantity,thickness,density,inner diameter,outer diameter of Washer Type A");
        scanf ("%lf %lf %lf %lf %lf", &quant,&thick,&dens,&innerd,&outerd);
    
    
    circleA1 = circleArea(innerd,outerd);
    weight1 = washerWeight(quant,thick,dens);
    //printf("%lf",a);
    return 0;
    }
    double washerWeight(double x,double y, double z);
    {
    return x*y*z;
    }
    
    
    double circleArea(double inner,double outer);
    {
    double pi = 3.142;
    
    
    
    
    outerArea = pi*outer*outer/4;
    innerArea = pi*inner*inner/4;
    
    
    totalArea = outerArea - innerArea;
    
    
    return(totalArea);
    
    
    
    
    }
    /*void printWeights(double)
    
    
    {
    }
    Derp.c:37: error: expected identifier or '(' before '{' token
    Derp.c:42: error: expected identifier or '(' before '{' token
    those errors
    */

  2. #2
    Registered User
    Join Date
    Oct 2011
    Posts
    6
    the errors when i copied it in are actually on lines 20 and 26 now. =/

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Remove the red semi-colons:

    Code:
    double washerWeight(double x,double y, double z);
    {
    return x*y*z;
    }
     
     
    double circleArea(double inner,double outer);
    Use the semi-colons at the end of the prototype, but not at the start of the actual functions.
    sh4de likes this.

  4. #4
    Registered User
    Join Date
    Oct 2011
    Posts
    6
    Thank you for your help I will be continuing working on this program all night.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 07-24-2011, 10:38 PM
  2. Replies: 1
    Last Post: 11-15-2010, 11:14 AM
  3. Replies: 3
    Last Post: 10-02-2007, 10:12 PM
  4. Replies: 1
    Last Post: 01-11-2007, 05:22 PM
  5. Compiler error error C2065: '_beginthreadex; : undeclared identifier
    By Roaring_Tiger in forum Windows Programming
    Replies: 3
    Last Post: 04-29-2003, 02:54 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21