#include <cstdlib>
#include <iostream>
using namespace std;
double meam(double a, double b, double c);
double maximum(double a, double b, double c);
double minimum(double a, double b, double c);
double a1;
double b1;
double c1;
int main(int argc, char *argv[])
{
cout << "Please give 3 numbers. It will return the Mean, Maximum, Minimum, Median, and Celsius (of each number)." << endl;
cout << "First number: ";
cin >> a1;
cout << "Second number: ";
cin >> b1;
cout << "Third number: ";
cin >> c1;
mean(a1,b1,c1);
system("PAUSE");
return EXIT_SUCCESS;
}
double meam(double a, double b, double c){
cout << "Calling mean(" << a << ", " << b << ", " << c ")" << endl;
double mean = (a + b + c)/2;
cout << "Mean returned " << mean << endl;
}
double maximum(double a, double b, double c){
if(a>b && a>c){
cout << "Maximum returned " << a << endl;
}
else if(b>a && b>c){
cout << "Maximum returned " << b << endl;
}
else{
cout << "Maximum returned " << c << endl;
}
}
double min(double a, double b, double c){
if(a<b && a<c){
cout << "Minimum returned " << a << endl;
}
else if(b<a && b<c){
cout << "Minimum returned " << b << endl;
}
else{
cout << "Minimum returned " << c << endl;
}
}
This is my code and i get an error
Quote
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c functions.cpp -o functions.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
functions.cpp: In function `int main(int, char**)':
functions.cpp:23: error: `mean' undeclared (first use this function)
functions.cpp:23: error: (Each undeclared identifier is reported only once for each function it appears in.)
functions.cpp: In function `double meam(double, double, double)':
functions.cpp:29: error: expected `;' before string constant
make.exe: *** [functions.o] Error 1
Execution terminated
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c functions.cpp -o functions.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
functions.cpp: In function `int main(int, char**)':
functions.cpp:23: error: `mean' undeclared (first use this function)
functions.cpp:23: error: (Each undeclared identifier is reported only once for each function it appears in.)
functions.cpp: In function `double meam(double, double, double)':
functions.cpp:29: error: expected `;' before string constant
make.exe: *** [functions.o] Error 1
Execution terminated
i am in a c++ class and that is how they showed me how to do "functions" you have to do a "function prototype"


Sign In
Create Account


Back to top









