You need to declare the functions before you can use them.
Either forward declare them:
#include <iostream>
using namespace std;
// forward declarations
void area(int a, int b);
void area(float a, float b);
void area(double a, double b);
int main() {
area(13.3, 67.4);
return 0;
}
void area(int a, int b){
cout << "The area is " << a * b << endl;
}
void area(float a, float b){
cout << "The area is " << a * b << endl;
}
void area(double a, double b){
cout << "The area is " << a * b << endl;
}
Otherwise, move the implementations above main():
#include <iostream>
using namespace std;
void area(int a, int b){
cout << "The area is " << a * b << endl;
}
void area(float a, float b){
cout << "The area is " << a * b << endl;
}
void area(double a, double b){
cout << "The area is " << a * b << endl;
}
int main() {
area(13.3, 67.4);
return 0;
}
That being said, since the implementations are exactly the same, just with different data types, consider using a single templated function instead:
#include <iostream>
using namespace std;
template<typename T>
void area(T a, T b){
cout << "The area is " << a * b << endl;
}
int main() {
area<double>(13.3, 67.4);
return 0;
}