Troubleshooting Code - not compiling

Hey guys, new to the forum and C on the whole. Have a project and I'm running into some problems which I dunno know how to get around. Can someone please review my code to let me know as to where my problems lie?

/*
/*
/* This program is designed to find the average accleration time for a motor-vehicle from three observed accleration times
/*
/* A modular style is used which constitute a number of functions to carry out tasks.
/* Functions: main - return type integer, input, process, output, print_list, calculate_mean - return type float.
/* Control constructs: sequence, selection, repetition.
/*
/* Processing mode:
/* Human Computer interation: Command line
/*
*/

/********************************************************************************************/
#include <stdio.h> // Preprocessor directive
// Link to library for I/O functions

#include <stdlib.h> // System Command



#include <ctype.h>
#include <string.h>

#define MAXLINE 25

char line[MAXLINE];


int main()
{ // begin function - main



/* Declaration of variables */


int tone = 0; //float - observed accelleration time 1
int ttwo = 0; //float - observed accelleration time 2
int tthre = 0; //float - observed accelleration time 3

/*Statement Section*/

//Get data from standard input - keyboard
input(&tone, &ttwo, &tthre); //subroutine call - input

//Program Termination
system("PAUSE");
return 0;

} // end function - main

/********************************************************************************************/

/* ------ Function - input ----- */
/* Purpose: To retrieve average accleration times for specific vehicle.
/*
/* Control Constructs: 1) Sequence, 2 Repition (For statement)
*/

int input()
{ // begin function

/* Declaration section - local variables */

int iteration = 0; // integer - a value stating repitition
int tone = 0; //float - observed accelleration time 1
int ttwo = 0; //float - observed accelleration time 2
int tthre = 0; // memory address reference - character type check


/* Statement section */



{//error checking
int error ( char *a )
unsigned x;
for ( x = 0; x < strlen ( a ); x++ )
if ( !isdigit ( a[x] ) ) return 1;
}


printf("\n Please enter the first value for the time taken for the vehicle to accelerate from 0-60MPH");
scanf_s("%d", &tone);
fgets(line, MAXLINE, stdin);
line[strlen ( line ) - 1] = '\0';
if(error(line)==0)
printf("\n 1st Vehicle Accelleration Time entered successfully .\n");
else
printf("\n Error in data entry. Please ensure that the value you enter is a floating point character:");

printf("\n Please enter the second value for the time taken for the vehicle to accelerate from 0-60MPH ");
scanf_s("%d", &ttwo);
fgets(line, MAXLINE, stdin);
line[strlen ( line ) - 1] = '\0';
if(error(line)==0)
printf("\n 2nd Vehicle Accelleration Time entered successfully .\n");
else
printf("\n Error in data entry. Please ensure that the value you enter is a floating point character: ");

printf("\n Please enter the third value for the time taken for the vehicle to accelerate from 0-60MPH ");
scanf_s("%d",&tthre);
fgets(line, MAXLINE, stdin);
line[strlen ( line ) - 1] = '\0';
if(error(line)==0)
printf("\n 3rd Vehicle Accelleration Time entered successfully .");
else
printf("\n Error in data entry. Please ensure that the value you enter is a floating point character: ");

}

} // end function - input

********************************************************************************************/

/* ----- Function - process ----- */
/*
/* Purpose: To process the respective means for each array (list). Service function used to
/* calculate the mean from the data in array (list).
/*
/* Function (subroutine) call: 1. calculate_mean.
/*
/* Control constructs: 1. Sequence
*/


// Function definition - process
void process(int*iteration,float*tone,float*ttwo,float*tthre,float*mean)

{ // begin function

/* Declaration section. - local variables */

float a_mean = 0; // float - a mean value
float *a_total; // address reference to float - total accelleration


/* Statement section */

// Calculate the mean given accelleration times
a_total = &tone + &ttwo + &tthre;
a_mean = calculate_mean(p_list, size); // subroutine call - calculate_mean and assigns value
*mean = a_mean;(total, 3); // return the value calculated



} // end function - process


/********************************************************************************************/
/* ----- Function - output ----- */
/*
/* Purpose: To output the average accelleration times and observed accellertation times to a file. Service
/* function used output the data in array (list).
/*
/*
/* Function (subroutine) call: 1. print_list.
/*
/* Control constructs: 1. Sequence, 2. Selection (If ... else statement)
*/

// Function protype - output
void print_list(FILE *ofp, int *, int size);

// Function definition - output
int ouput()
{ // begin - output


/* Statement section. */


// Stream report header to file
fprintf(ofp, "\n Accelleration Means . \n\n");
fprintf(ofp, "\n Observed Values. \n\n");

// Put data (Observed Values) to file
print_list(&tone, &ttwo, &tthre); // subroutine call - print_list
fprintf(ofp, "\n Mean accelleration: ", meanA);

// Stream report footer.
fprintf(ofp, "\n\n ------ End Of Report. ------ ");

system("PAUSE");
fclose(ofp); // Close file.
} // end else

} // end function - output

/********************************************************************************************/


/* ------ Function defintion - calculate_mean ----- */
/*
/* Purpose: To calculate the mean for 3 float values. Returns a float value.
/*
/* Parameters: Structures -
/* Primitive variables - size passed to function by value.
/*
/* Control construct: 1. Sequence
*/

float calculate_mean(float*tone,float*ttwo,float*tthre);
{ // begin function

/* Declaration section - local variables */

float mean = 0; // float - mean value initialed to 0 (zero)
int total = 0; // integer - total value initialed to 0 (zero)

/* Statement section */

// Calculate Mean
mean =(float) (*a_total/3);

return mean; // return mean value

} // end function - calculate_mean


Thanks for any help in advance
- ZoRz
There are quite a few errors. The two that pop out immediately to me are that (1) you don't have any function
prototypes, and (2) you call the input function with three parameters, but you define the function with no parameters.

Like I said, there are many more errors. You should look at the errors that your compiler reports. The compiler will do a much more thorough job of inspecting your code, and it will direct you to the exact line (or at least very close to the line) where the error occurs.

Lastly, next time you post code, please put it inside [code][/code] blocks.
Last edited on
Topic archived. No new replies allowed.