source

1. sachin augustine

don't we have to declare the function printNumber …?????

2. the best series, great work!

python was saving a lot :v

4. how to make a million bucks within 7 minutes. :)))))))))))

5. So thats how you make a million dollars?

6. Here's what I tried to do, Input any number with decimals or just a number. If it's an int it will print "I am printing int" if it is float it will print "I am printing float"

But it doesn't work, not sure why:

#include <iostream>
using namespace std;

void printnumber (int x){

cout << "I am printing an integer " << x << endl; //leave a space before quotes end to avoid text running together.
}

void printnumber (float x){

cout << "I am printing a float" << x << endl;
}

int a;
float b;

int main()
{

Cin >> a||b;
//int a = 54;
//float b = 65.6789;

printnumber (a);
printnumber (b);

return 0;
}

7. I'm not sure how "behind the scenes" this is, since one would still have to type in a number that is an integer in (a) and a float in (b). I thought it would be cool to try to make it ask for a number using CIN doing more like you seem to be describing, but couldn't figure out how to make it work.

8. shamsulhaq soomro

What, if I declare two float/int?
Then what will a function do if I say it to return float/int…??

9. what is the different between the data 'float' and 'double' ??

10. i got a bunch of 0.05s with same program

11. "So thats how you make a million dollars"

12. Can't i use the data type auto to create a function prototype that can store any data?

13. Debadip Choudhury

can be have string and int or float for same function

14. my dude!!!!

15. Also you can do void printSomething (int x , float x) , same concept just putting both variables in one function.

16. Bryan SWAGGBEAST

ok so why do you need to use int x when its actually only b and a ?

17. Bucky are you a millionaire? as you seem to know many languages! 😀

18. Thirunagaru Sriman

can i know how this program is used in development sources.?

19. 2 years… didnt understand a shit … and here.. hardly 6 minutes and i understood it .. dont know how to thank you ! tysm !

20. I have watched this video . Now I am looking forward to one milion dollars to come. I hope this won't overload me.

21. LIKE THIS POST IF YOU FARTED TODAY ALSO

1:51 we do this through the use of something called templates

22. For what hell is it needed anyway?
Just to ease source code modification?
Which function to call is determined at compile time.
Wouldn't that be easier to create truncating function that can solely accept all primitive types and do the job?

23. why does printN(a*1.) say it's double?

void printN(int n)
{
cout << "integer " << n << endl;
}
void printN(float n)
{
cout << "float " << n << endl;
}
void printN(double n)
{
cout << "double " << n << endl;
}

int main()
{
int a=23;
float b=23.23;

printN(a*1.);
printN(b);
}

24. billyblackburn87

In Java if you just used float it would except both the int and the float. Thats a big flaw in C++

25. I have a question can I make a program in which suppose we let the user enter a number and the user enter a number like 32.90898 and make the result print like "its an integer" instead of giving value to the variables can we make user to give the value and print out the result according to the value if you can help me cuz I am not able to do this.

26. Just watched 30 tutorials 😐 in one day
the weird thing is that am not bored
I have been bored all my life

27. You can use templates instead of repeating the code.

28. It is a great tutorial… It helped a lot on C++ class.. Thanks.

29. Perpetual Divertissement

i'm still poor though D;

30. Eshwaren Manoharen

Achievement Unlocked : LVL 30!

31. Warren McAllister

Bucky is my homie!

32. So that is how you make a million dollars xD
priceless :p

33. alright , so i have a doubt…..
int x cant include float variables but float variable can include int variables,
how does the program understand that?
i mean to say 38=38.00

34. So if I do this:

#include <iostream>

using namespace std;

void printNumber(int x){
cout << "i am print an interger" << x << endl;
}

void printNumber(float x){
cout << "now i am print a float" << x << endl;
}

int main()
{
int a = 54;
int c = 24;
float b = 32.4896;
int x = 25;

printNumber(a);
printNumber(b);
printNumber(c);
printNumber(x);

How does the program know how to reconcile the "X's"? I.e. why doesn't it associate x in the "void printNumber(int x)" with "int x" in the int main?

35. Someone said this is called function overriding in Java. Overriding makes more sense than overloading. A noob would have an idea what a function override is than a function overload without knowing what they are ahead of time. C++ comes up with odd names

36. overloaded functions need to have the same amout of parameters, right?

37. why can we just write it like this?

void printNumber(float x, int x)
{

}

and lastly why use void if we are expecting a result back by using this function ? i mean its going to cout something right? so it is going to do something use this and pass a result right ? so why use void?

and in all your tutorials you keep using the user puts in this or that but you go and write it in on the ide and then compile it thus giving you the result BUT IF the  user will input then it should be CIN and thats after you build a data type and a variable = to zero cuz we dont know what the user might type in , and then compile the code and NOW you chud say your fav line "the user will type in and thus run your code and cout the result

38. bucky WHY do you keep saying user enters and then you go on to write on the parameter of COUT what the user chud be putting in VIN ???? dont complicate things by saying something but doing something else, use the functions NEVER say the user puts…….. and den go on to cout<< rather cin>> so that way it makes sense "cents" to everything thats been sum'up to this point i mean com'on this tu 28 trat us like we are keeping up not like we are still on tut 2 or something

39. Tómas Óskar Friðriksson