Why we can't write the functions like this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why we can't write the functions like this?

#include <iostream> using namespace std; void printNumber(int x) { cout << "Prints an integer: " << x << endl; } void printNumber(float x) { cout << "Prints a float: " << x << endl; } int main() { printNumber(2); printNumber(2.1); }

11th Nov 2018, 6:19 PM
Igor The Golden Fish
Igor The Golden Fish - avatar
1 Answer
+ 1
Thank's, it is working!
11th Nov 2018, 6:54 PM
Igor The Golden Fish
Igor The Golden Fish - avatar