# C++ Tutorial – 6 – Beginning Functions

GitHub –
reddit –
Support –
thenewboston –

Posted

in

by

Tags:

### 41 responses to “C++ Tutorial – 6 – Beginning Functions”

1. u can also replace the math function with # include<math.h>

2. Which is the software u r using

3. Why in the world are did you do "using namespace std" within main???

4. it uses double because its twice as precise as float

5. Can we become a gud hacker on games after all learning all ur tuts?

6. Include C Meth Library. Done.
About the name "double" – used to be synonym for long float. Long float was removed in C89 standard. (to be more specific, single precision and double precision originated in Fortran)

7. 9 + 11 = 20… 9/11

8. is it true king kong was the best programmer?

9. Visual studio is so much faster and better.

10. @Obretin use this "The square root of " . a . "is" . b;

11. when i hit run, it tells me the square root of the number but with no spaces…it says: the square root of121is11…i wanted to be:the square root of 121 is 11
any help?

12. I feel like I should be paying you tuition for watching these videos.

13. you dont have to do the whole thing with num2, you can just say sqrt(num1) when you need the square root.

14. So basically, what 'double' does is that it adds decimals? So using 'int' will just round it to the nearest whole?

15. thanks i understand now!

16. The square root of a number is the number you start with when you square them. Example: 9² = 9 * 9 = 81. Here, the square root of 81 is 9. If you don't know the exact meaning of squaring/cubing, when you square a number, you multiply that number by itself once. Cubing is exactly the same, but you multiply it by itself twice (9 * 9 * 9). The ² or ³ is the amount of times you multiply a number by itself.

17. im 10 i like programming in notepad c++ and java. but.. what is a square root of something?

18. 19. 20. Damn, thanks to pascal this shit is easier to comprehend so far. :O

21. Double is not really double precision as it has more than double precision of a float. It has double the space in the RAM. On a 32bit system, float uses 32bit (1 bit for the sign, 8 bits for the exponent, 23 bits for the significant) and double uses 64bit (1 bit for the sign, 11 bits for the exponent, 52 bits for the significant). Double uses twice as much space as a float.

22. Nice video dude. Great job explaining so far, and I'm getting it all. I now like experimenting in C++ and FreeBasic. I started with Yabasic and moved to Freebasic from there. Very fun. Keep up the nice tutorials.

23. Yes. Hold your horses. I'm sure Bucky will get to this in some of the later tutorials.

24. im new to this i was wondering if anyone knows the answer to my question, is it not possible to make another function beside the main, and have that funcion after main but somehow be called in by main i think im confusing my self,
int main()
{
call to 1function
}
1 function()
{
{

25. std::cout <<"Nice video!" << std::endl;

26. 27. better than any teacher ive had at morgan state university smh

28. 29. just press F9

30. lmao i just downloaded the new AVG and it doesn't let me debug it since it find viruses…
wtf

31. the 'double' data type is also similar to the 'float' data type, although as @HappyFoxIsHappy has pointed out, the 'double' data type is used because it is more precise than one floating point

32. int is only full integers, double will take decimals and multiply them, add them, etc.

33. Because num 2 is the sqrt of num1 right… and the sqrt of num1 is going you a value with decimals..
"int" can only take numbers that dont have decimals (eg 5).. "double" can take numbers with decimals (eg 5.85)

34. These tuts are GREAT! Omg I love this.

35. i wanna know why too!

36. why can't I use
int num1;
double num1
???

37. actually a Float variable is the standard real number, a double is a real number with twice the amount of maximum decimal points.

38. How do you create functions, not use them?

39. Can you make a list of variables and what they are?

40. hey man i got a problem…when i execute it , it normaly says "pick ur number" when i choose a number and press enter it shows "the square root of……." and closes really fast. beacuse system("pause") didn't work for me i have cin.get();

41. watch the first part