ok i dont quite know why i keep getting these error in my program.. here is the program:

#include<stdlib.h>
#include<stdio.h>
#include<math.h>

Void open(void);
int read(float*);
float average(float*);
void write(float*,float);
void close(void);

FILE *fptrin,*fptrout;

main()
{
    float number[10],non,ave;
    open();
    read(number);
    non=read(number);
    ave=average(number,non);
    write(number,ave,non);
    close();
    return(0);
}

void open(void)
{
    fptrin=fopen("avg.dat""r");
    if(fptrin==0)
    {
        printf("\nFile Will Not Open!!!!\n);
        exit(0);
    }
    return;
void close(void)
{
    fclose(fptrin);
    fclose(fptrout);
    return;
}
void write(float *number,float,ave,int non)
{
    int i;
    for(i=0;i<non;i++)
    {
        fprintf(fptrout,"%f\n",number[i];
        printf("\n%f",number[i]
    }
    fprintf(fptrout,"%f",ave);
    printf("\n%f",ave);
    return;
}
int read(float *number)
int i,done;
for(i=0;i<non;i++)
{
    done=fscanf(fptrin,"%f",&number[i];
    if(done==-1)break;
}
return(i);
float average(float *number,int non)
float sum,avg;
printf(\navg is beint calculated!!!");
sum=0;
for(i=o;i<non;i=i++)
{
    sum=sum+number[i];
    {
        avg=sum/i;
        return(avg);
    }
}

}

Line 8:

void write(float*,float);

Declaration of function write with only 2 parameters.
Line 40:

void write(float *number,float,ave,int non)

implementation of function from line 8 with 3 parameters (no warning because it's considered another function).
Line 20:

    write(number,ave,non);

calling function write with 3 parameters but, function header is declared below the main function (assuming it's a C file) so, it doesn't know where to find that function. But, it sill finds the write function that has only 2 parameters, thus the error.

Later edit:
Line 6:

Void open(void);

it should be:

void open(void);

C/C++ is case sensitive!!!

printf("\nFile Will Not Open!!!!\n);

You are missing a terminating quotation mark. Also I would be very scared if an application would respond to me using so many exclamation marks, but this is not technically an error.

printf(\navg is beint calculated!!!");

You are missing the opening quotation mark.

Void open(void);

"Void" is not a valid type. Use "void".

Your opening and closing of functions is a mess. Use parenthesis properly.. The following functions need to be fixed: "open", "read" and "average".

float average(float *number,int non)

This is the function header for the "average" function, but it is declared as:

float average(float*);

They should match.

void write(float *number,float,ave,int non)

There's a comma between "float" and "ave" that doesn't belong there.

Your "write" function has the following header (after a previous fix):

void write(float *number,float ave,int non)

But it is declared as

void write(float*,float);

They should match.

fptrin=fopen("avg.dat""r");

You're missing a comma between the two strings.

fprintf(fptrout,"%f\n",number[i];
        printf("\n%f",number[i]

These are missing the ')' symbol and the last also misses the semicolon.

In your "read" function:

for(i=0;i<non;i++)

"non" does not exist in that function. I don't really want to look into the logic of your application right now so I've just added a 'non' parameter to it, like the other functions.

done=fscanf(fptrin,"%f",&number[i];

You are missing the closing ')' symbol again.

for(i=o;i<non;i=i++)

Both i and o are undeclared in this function. ("average") As mentioned earlier I do not want to look into your code's logic, so I don't really know what this should be. I declared 'i' inside the function and replaced 'o' with '0'.

At this point there are no errors anymore, but some warnings:

main()

return an int.

i=i++

While technically not an error, this won't do what you want. "i++" is sufficient.

float average(float *number,int non)

This function doesn't always return a float. You should make it so it does.

read(number, non);

non is uninitialized. Try to always initialize your variables, even when it's not needed.

Applying all these fixes results in the following:

#include<stdlib.h>
#include<stdio.h>
#include<math.h>

void    open    (void);
int     read    (float*, int);
float   average (float*, int);
void    write   (float*,float, int);
void    close   (void);

FILE *fptrin,*fptrout;

int main()
{
    float number[10],non = 0,ave;

    open();
    read(number, non);
    non = read(number, non);
    ave = average(number,non);
    write(number,ave,non);
    close();

    return(0);
}

void open(void)
{
    fptrin=fopen("avg.dat", "r");
    if(fptrin==0)
    {
        printf("\nFile Will Not Open!!!!\n");
        exit(0);
    }
    return;
}

void close(void)
{
    fclose(fptrin);
    fclose(fptrout);
    return;
}

void write(float *number,float ave,int non)
{
    int i;
    for(i=0;i<non;i++)
    {
        fprintf(fptrout,"%f\n",number[i]);
        printf("\n%f",number[i]);
    }
    fprintf(fptrout,"%f",ave);
    printf("\n%f",ave);
    return;
}

int read(float *number, int non)
{
    int i,done;
    for(i=0;i<non;i++)
    {
        done=fscanf(fptrin,"%f",&number[i]);
        if(done==-1)break;
    }
    return(i);
}

float average(float *number,int non)
{
    int i;
    float sum,avg;
    printf("\navg is beint calculated!!!");
    sum=0;
    for(i=0;i<non;i++)
    {
        sum=sum+number[i];
        {
            avg=sum/i;
            return(avg);
        }
    }
    return 0;
}

This compiles. I've done nothing more than to make it compile though. I'm sure it won't work as you want it too as it still contains things that strike me as "odd" on first sight. E.g:

sum=sum+number[i];
        {
            avg=sum/i;
            return(avg);
        }

But myeah, if you need more help just ask that istead. I feel I have already spend more time on this than you did on your post so that's a good sign to stop.

I still can't help to feel that you're either trolling or you're dyslectic. Many of the errors you got are the easiest ones to fix and typically look like "expected <symbol> at position <x>". There's not much not to understand about it. I find it hard to believe that you genuinely don't understand why this doesn't compile..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.