Not sure what's wrong...

I keep gettin this error and I don't know how to solve it...

error C2065: 'AveXYZ' : undeclared identifier

can someone help me please?

//-----------------------------------
#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;

//-----------------------------------
float Display(int x, int y, int z);
float ComputeAve(int x,int y,int z);
float FindMax(int x, int y, int z);
float FindMin(int x, int y, int z);
//-----------------------------------

int main()
{
    int x, y, z;

    //read data into x, y, and z
    cout << "Enter 3 integer numbers: ";
    cin >> x >> y >> z;

    //compute the average of x, y, and z
    float AveXYZ;
    AveXYZ = ComputeAve(x,y,z);

//Find the maximum of x, y, and z
    int maxXYZ;
    maxXYZ = FindMax(x,y,z);

    //Find the minimum of x, y, and z
    int minXYZ;
    minXYZ = FindMin(x,y,z);

    //Display average, maximum, and minimum
    Display(AveXYZ, maxXYZ, minXYZ);

    //terminate program
    return 0;
}


//-----------------------------------
//  Name: ComputeAve
//  Input: the average equation
//  Output: the average of x,y,z
//-----------------------------------
float ComputeAve(float x, float y, float z)
{
    return (x+y+z)/3;
}
//-----------------------------------
//  Name: FindMax
//  Input: None
//  Output: The Maximum
//-----------------------------------
int maxXYZ(int x, int y, int z)
{
    if (x > y && x > z)
    {return x;}
    if (y > x && y > z)
    {return y;}
    if (z > x && z > y)
    {return z;}
}
//-----------------------------------
//  Name: FindMin
//  Input: None
//  Output: The Minimum
//-----------------------------------
int minXYZ(int x, int y, int z)
{
    if (x < y && x < z)
    {return x;}
    if (y < x && y < z)
    {return y;}
    if (z < x && z < y)
    {return z;}
}
//----------------------------------------------
// Name: Display
// Input: None
// Output: display Average, Maximum, and Minimum
//----------------------------------------------
float Display(int x, int y, int z)
{
    cout << "\tAverage= " << AveXYZ << endl;
    cout << "\tMaximum= " << maxXYZ << endl;
    cout << "\tMinimum= " << minXYZ << endl;

    return 0;
}

Edited 3 Years Ago by Nick Evan: Fixed formatting

This function :

float Display(int x, int y, int z)
{
cout << "\tAverage= " << AveXYZ << endl;
cout << "\tMaximum= " << maxXYZ << endl;
cout << "\tMinimum= " << minXYZ << endl;

return 0;
}

1st should be a void function.
Seconds you meant :

float Display(int x, int y, int z)
{
cout << "\tAverage= " << x<< endl;
cout << "\tMaximum= " << y<< endl;
cout << "\tMinimum= " << z<< endl;

return 0;
}

Third, make the x,y,z a different variable name, something more meaningful.

This function :

float Display(int x, int y, int z)
{
cout << "\tAverage= " << AveXYZ << endl;
cout << "\tMaximum= " << maxXYZ << endl;
cout << "\tMinimum= " << minXYZ << endl;

return 0;
}

1st should be a void function.
Seconds you meant :

float Display(int x, int y, int z)
{
cout << "\tAverage= " << x<< endl;
cout << "\tMaximum= " << y<< endl;
cout << "\tMinimum= " << z<< endl;

return 0;
}

Third, make the x,y,z a different variable name, something more meaningful.

okay i did this:

#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;

//-----------------------------------
void Display(int x, int y, int z);
float ComputeAve(int x,int y,int z);
float FindMax(int x, int y, int z);
float FindMin(int x, int y, int z);
//-----------------------------------

int main()
{
int x, y, z;

//read data into x, y, and z
cout << "Enter 3 integer numbers: ";
cin >> x >> y >> z;

//compute the average of x, y, and z
float AveXYZ;
AveXYZ = ComputeAve(x,y,z);

//Find the maximum of x, y, and z
int maxXYZ;
maxXYZ = FindMax(x,y,z);

//Find the minimum of x, y, and z
int minXYZ;
minXYZ = FindMin(x,y,z);

//Display average, maximum, and minimum
Display(AveXYZ, maxXYZ, minXYZ);

//terminate program
return 0;
}


//-----------------------------------
// Name: ComputeAve
// Input: the average equation
// Output: the average of x,y,z
//-----------------------------------
float ComputeAve(float x, float y, float z)
{
return (x+y+z)/3;
}
//-----------------------------------
// Name: FindMax
// Input: None
// Output: The Maximum
//-----------------------------------
int maxXYZ(int x, int y, int z)
{
if (x > y && x > z)
{return x;}
if (y > x && y > z)
{return y;}
if (z > x && z > y)
{return z;}
}
//-----------------------------------
// Name: FindMin
// Input: None
// Output: The Minimum
//-----------------------------------
int minXYZ(int x, int y, int z)
{
if (x < y && x < z)
{return x;}
if (y < x && y < z)
{return y;}
if (z < x && z < y)
{return z;}
}
//----------------------------------------------
// Name: Display
// Input: None
// Output: display Average, Maximum, and Minimum
//----------------------------------------------
void Display(float AveXYZ, int maxXYZ, int minXYZ)
{
cout << "\tAverage= " << AveXYZ << endl;
cout << "\tMaximum= " << maxXYZ << endl;
cout << "\tMinimum= " << minXYZ << endl;
}

but now i get a
fatal error LNK1120: 4 unresolved externals

by the way i just changed the prototype to the same as it was in the function... so that resolved 1 fatal error... 3 more to go....?

#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;

//-----------------------------------
void Display(float AveXYZ, int maxXYZ, int minXYZ);
float ComputeAve(int x,int y,int z);
float FindMax(int x, int y, int z);
float FindMin(int x, int y, int z);
//-----------------------------------

int main()
{
    int x, y, z;

    //read data into x, y, and z
    cout << "Enter 3 integer numbers: ";
    cin >> x >> y >> z;

    //compute the average of x, y, and z
    float AveXYZ;
    AveXYZ = ComputeAve(x,y,z);

//Find the maximum of x, y, and z
    int maxXYZ;
    maxXYZ = FindMax(x,y,z);

    //Find the minimum of x, y, and z
    int minXYZ;
    minXYZ = FindMin(x,y,z);

    //Display average, maximum, and minimum
    Display(AveXYZ, maxXYZ, minXYZ);

    //terminate program
    return 0;
}


//-----------------------------------
//  Name: ComputeAve
//  Input: the average equation
//  Output: the average of x,y,z
//-----------------------------------
float ComputeAve(float x, float y, float z)
{
    return (x+y+z)/3;
}
//-----------------------------------
//  Name: FindMax
//  Input: None
//  Output: The Maximum
//-----------------------------------
int maxXYZ(int x, int y, int z)
{
    if (x > y && x > z)
    {return x;}
    if (y > x && y > z)
    {return y;}
    if (z > x && z > y)
    {return z;}
}
//-----------------------------------
//  Name: FindMin
//  Input: None
//  Output: The Minimum
//-----------------------------------
int minXYZ(int x, int y, int z)
{
    if (x < y && x < z)
    {return x;}
    if (y < x && y < z)
    {return y;}
    if (z < x && z < y)
    {return z;}
}
//----------------------------------------------
// Name: Display
// Input: None
// Output: display Average, Maximum, and Minimum
//----------------------------------------------
void Display(float AveXYZ, int maxXYZ, int minXYZ)
{
    cout << "\tAverage= " << AveXYZ << endl;
    cout << "\tMaximum= " << maxXYZ << endl;
    cout << "\tMinimum= " << minXYZ << endl;
}

Edited 3 Years Ago by Nick Evan: Fixed formatting

Your function prototype and your function definition are not the same.

You have

void Display(float AveXYZ, int maxXYZ, int minXYZ);
float ComputeAve(int x,int y,int z);
float FindMax(int x, int y, int z);
float FindMin(int x, int y, int z);

Does this match the definition that you provide? Are the names the
same for the prototype and the definition?

Your function prototype and your function definition are not the same.

You have

void Display(float AveXYZ, int maxXYZ, int minXYZ);
float ComputeAve(int x,int y,int z);
float FindMax(int x, int y, int z);
float FindMin(int x, int y, int z);

Does this match the definition that you provide? Are the names the
same for the prototype and the definition?

I'm not sure exactly what you mean... but my whole thing is that... my prototype should indicate what my function will exactly operate? Um... I'm just trying to make my program run the average, maximum, and minimum... so I'm pretty much at a loss...

I really thank you firstPerson for replying so faithfully...

You minXYZ and your maxXYZ function name should be :
FindMin and FindMax.

So replace the word minXYZ with FindMin and replace your maxXYZ with
FindMax.

k... now i'm gettin a WHOLE bunch of errors

// Purpose: Complete the program to allow the entering of 3 integer
// numbers and have the program calculate the average, maximum,
// and minimum.
//------------------------------------------------------------------------

#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;

//-----------------------------------
void Display(float AveXYZ, int maxXYZ, int minXYZ);
float ComputeAve(int x,int y,int z);
float FindMax(int x, int y, int z);
float FindMin(int x, int y, int z);
//-----------------------------------

int main()
{
    int x, y, z;

    //read data into x, y, and z
    cout << "Enter 3 integer numbers: ";
    cin >> x >> y >> z;

    //compute the average of x, y, and z
    float AveXYZ;
    AveXYZ = ComputeAve(x,y,z);

//Find the maximum of x, y, and z
    int maxXYZ;
    maxXYZ = FindMax(x,y,z);

    //Find the minimum of x, y, and z
    int minXYZ;
    minXYZ = FindMin(x,y,z);

    //Display average, maximum, and minimum
    Display(AveXYZ, maxXYZ, minXYZ);

    //terminate program
    return 0;
}


//-----------------------------------
//  Name: ComputeAve
//  Input: the average equation
//  Output: the average of x,y,z
//-----------------------------------
float ComputeAve(float x, float y, float z)
{
    return (x+y+z)/3;
}
//-----------------------------------
//  Name: FindMax
//  Input: None
//  Output: The Maximum
//-----------------------------------
int FindMax(int x, int y, int z)
{
    if (x > y && x > z)
    {return x;}
    if (y > x && y > z)
    {return y;}
    if (z > x && z > y)
    {return z;}
}
//-----------------------------------
//  Name: FindMin
//  Input: None
//  Output: The Minimum
//-----------------------------------
int FindMin(int x, int y, int z)
{
    if (x < y && x < z)
    {return x;}
    if (y < x && y < z)
    {return y;}
    if (z < x && z < y)
    {return z;}
}
//----------------------------------------------
// Name: Display
// Input: None
// Output: display Average, Maximum, and Minimum
//----------------------------------------------
void Display(float AveXYZ, int maxXYZ, int minXYZ)
{
    cout << "\tAverage= " << AveXYZ << endl;
    cout << "\tMaximum= " << maxXYZ << endl;
    cout << "\tMinimum= " << minXYZ << endl;
}

Edited 3 Years Ago by Nick Evan: Fixed formatting

This should work. However, your all of your function does not
necessarily return something. Also use code goes here

// Purpose: Complete the program to allow the entering of 3 integer
// numbers and have the program calculate the average, maximum,
// and minimum.
//------------------------------------------------------------------------


#include <iostream>
#include <cmath>
using namespace std;

//-----------------------------------
void Display(float AveXYZ, float maxXYZ, float minXYZ);
float ComputeAve(float x,float y,float z);
float FindMax(float x, float y, float z);
float FindMin(float x, float y, float z);
//-----------------------------------

int main()
{
float x, y, z;

//read data into x, y, and z
cout << "Enter 3 integer numbers: ";
cin >> x >> y >> z;

//compute the average of x, y, and z
float AveXYZ;
AveXYZ = ComputeAve(x,y,z);

//Find the maximum of x, y, and z
float maxXYZ;
maxXYZ = FindMax(x,y,z);

//Find the minimum of x, y, and z
float minXYZ;
minXYZ = FindMin(x,y,z);

//Display average, maximum, and minimum
Display(AveXYZ, maxXYZ, minXYZ);

//terminate program
return 0;
}


//-----------------------------------
// Name: ComputeAve
// Input: the average equation
// Output: the average of x,y,z
//-----------------------------------
float ComputeAve(float x, float y, float z)
{
return (x+y+z)/3;
}
//-----------------------------------
// Name: FindMax
// Input: None
// Output: The Maximum
//-----------------------------------
float FindMax(float x, float y, float z)
{
if (x > y && x > z)
{return x;}
if (y > x && y > z)
{return y;}
if (z > x && z > y)
{return z;}
}
//-----------------------------------
// Name: FindMin
// Input: None
// Output: The Minimum
//-----------------------------------
float FindMin(float x, float y, float z)
{
if (x < y && x < z)
{return x;}
if (y < x && y < z)
{return y;}
if (z < x && z < y)
{return z;}
}
//----------------------------------------------
// Name: Display
// Input: None
// Output: display Average, Maximum, and Minimum
//----------------------------------------------
void Display(float AveXYZ, float maxXYZ, float minXYZ)
{
cout << "\tAverage= " << AveXYZ << endl;
cout << "\tMaximum= " << maxXYZ << endl;
cout << "\tMinimum= " << minXYZ << endl;
}

Edited 3 Years Ago by mike_2000_17: Fixed formatting

wow... those small things... maan... thanks a lot... it really helped out...

i can see what i did wrong and going to pay more closely attention...

anyways... i'll use code thing in the future from now on

THANK YOU

this is simple ... you declared AveXYZ but in the function display you send AveXYZ by parameter and there you use variable x but in cout statement you use AVEXYZ instead of x.... i hope u get the answer and fix your error

float Display(int x, int y, int z)
{
    cout << "\tAverage= " << AveXYZ << endl;
    cout << "\tMaximum= " << maxXYZ << endl;
    cout << "\tMinimum= " << minXYZ << endl;

    return 0;
}

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This question has already been answered. Start a new discussion instead.