Cpp function overloading

22 Views Asked by At

I am refreshing my knowledge using Sololearn App. I have the following code that does not run. Could someone please explain to me why?

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

void add(int a, int b) {

    cout << a + b<< endl;   
}
void add(float a, float b) {

    cout << a + b;    
}

int main() {
    
    //calling
    add(5,6);
    add(1.2, 6.5);
    
    return 0;
}

Sololearn Screenshot

0

There are 0 best solutions below