Help with error in c program.

This is a discussion on Help with error in c program. within the C Programming forums, part of the General Programming Boards category; Code: #include<stdio.h> void get_problem(void); void get_2pt(void); void display2_pt(void); void display_slope_intcpt(void); void get_pt_slope(void); void slope_intcpt_from2_pt(void); void intcpt_from_pt_slope(void); void display_pt_slope(void); int main(void) ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    1

    Help with error in c program.

    Code:
    #include<stdio.h>
    
    void get_problem(void);
    void get_2pt(void);
    void display2_pt(void);
    void display_slope_intcpt(void);
    void get_pt_slope(void);
    void slope_intcpt_from2_pt(void);
    void intcpt_from_pt_slope(void);
    void display_pt_slope(void);
    
    int
    main(void)
    
    {
                    char any_char;
    do
    {
    
                    double n1, slope, x1, y1, x2, y2, b;
                    
    
            get_problem();
    
    if(n1 == 1){
    
            get_2pt();
            display2_pt();
            slope_intcpt_from2_pt();
            display_slope_intcpt();
    
    }else if(n1 == 2){
    
            get_pt_slope();
            display_pt_slope();
            intcpt_from_pt_slope();
            display_slope_intcpt();
    }
    
    
            printf("\nDo you wish to calculate another vector sum?(Y/N)\n");
            scanf(" %c", &any_char);
    }
    
    while((any_char == 'y') || (any_char == 'Y'));
    
       return(0);
    }
    
    
    
    void
    get_problem(double &n1)
    {
            printf("Select the form that you would like to convert to slop-intercept form:/n");
            printf("1. Two-point form (you know two points on the line)/n");
            printf("2. Point-slope form (you know the line's slope and one point)/n");
            scanf(" %lf", &n1);
    }
    
    void
    get_pt_slope(double *slope, *x1, *y1)
    {
            printf("Enter the slope =>");
            scanf(" %lf", &slope);
            printf("\nEnter the x-y corrdinates of the point separated by a space =>");
            scanf(" %lf%lf", &x1, %y1);
    }
    
    
    void
    slope_intcpt_from2_pt(double *m, x1, x2, y1, y2)
    {
            m = (y2 - y1)/(x2 - x1)
    
    }
    
    void
    display_pt_slope(double m, y1, x1)
    {
            printf("Point-Slope form: \n")
            printf("y - %f = %f(x - %f)", &y1, &m, &x1)
    }
    
    void
    display_slope_intcpt(double slope, b)
    {
            printf("\nSlope-intercept form:\n");
            printf("y = %fx + %f", &slope, &b);
    }
    
    void
    display_2pt(double y1, y2, x1, x2)
    {
            printf("Two-point form: \n");
            printf("    (%f - %f)\n", &y2, &y1);
            printf("m = ---------\n");
            printf("    (%f - %f)\n", &x2, &x1);
    }
    
    
    void
    get_2pt(double x1, x2, y1, y2)
    
    {
            printf("Enter the x-y corrdinates of the first point separated by a space =>")
            scanf("%f%f", &x1, &y1)
            printf("Enter the x-y corrdinates of the second point separated by a space =>")
            scanf("%f%f", &x2, &y2)
    }
    
    void
    intcpt_from_pt_slope(double &b)
    {
     b = m*x1 + y1
    }
    error:

    [C++ Error]Unit1.c(60): E2293 ) expected

  2. #2
    Registered User carrotcake1029's Avatar
    Join Date
    Apr 2008
    Posts
    398
    Three of your functions above have code in them that aren't line terminated with a semicolon. Also, with an error like that, try looking at line 60. The compiler is just trying help you.

  3. #3
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    you have declared all the functions to take no arguments(void) but while defining them you're passing arguments to them.that might be the cause of the error.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

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