#include <iostream>
using namespace std;
// 함수 오버로딩
int add(int a, int b) {
return a + b;
}
double add(double a, double b) {
return a + b;
}
int main() {
int x = 3, y = 5;
double p = 2.5, q = 4.1;
cout << "정수 더하기: " << add(x, y) << endl; // int 버전 호출
cout << "실수 더하기: " << add(p, q) << endl; // double 버전 호출
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: