Why aren't you my C++ instructor?... Thanks for this video! You make learning this so much easier than my lack luster instructor!
@ReelLearning12 жыл бұрын
To answer your question about whether it is possible to write a function that calculates both areas, the answer is yes. You cannot return more than one value from a function, but you can pass references to vars defined in main to the function to hold the areas for the circle and square. This approach gets around the limitation of only returning one value, but violates good programming practice of only doing one conceptual action/task in a function. I recommend writing two separate functions.
@ReelLearning12 жыл бұрын
Thanks! I'm glad you found the video useful.
@ReelLearning12 жыл бұрын
Good programming practice would dictate not writing a function that calculates both the area of a circle AND a square. A function should only do one conceptual action/task. This makes your code better/easier to understand, reuse, maintain and test/debug. Doing a google search for "writing good functions" or "best practices for writing functions" should provide you with a lot of resources.
@RidsieD10 жыл бұрын
sir which software do you think is the best for c++???
@johnlopez57775 жыл бұрын
You get a like for your patience 😄
@inquisitive87112 жыл бұрын
Good job
@t2uan12 жыл бұрын
You should have more viewers. Your videos are very descriptive and easy to follow.
@jahanzebawan13969 жыл бұрын
fantastic, thax and keep uploading more
@AaKnSdHrAoYid11 жыл бұрын
thank u vey much sir your video really held in understanding functions
@buildabs9 жыл бұрын
Great videos. I have only got this far at the moment so haven't watched all videos so my suggestion I am going to give may already be in one of the further videos, but if you do decide to add more videos and it doesn't already exist can I just suggest making a video prior to this one explaining functions from a complete beginners perspective as I found this pretty confusing. This is because I didn't know or understand what functions were exactly and that functions could go before the int main etc and couldn't understand how getPosInt etc worked and how the result was outputted to the user? I hope you understand what I mean because even I have trouble understanding myself sometimes.
@plemyk9 жыл бұрын
Al May Check out "Cave Of Programming" channel.He has a great series on C++ for the beginner.I highly recommend it.
@buildabs9 жыл бұрын
plemyk Thanks. I did start with those videos actually but I kind of couldn't really get into it. I find this chaps videos easy to follow along with, although I might go back to the other channel at some point.
@plemyk9 жыл бұрын
Al May Also try "ICT Tutorial Channel" channel,another great series on C++.
@Direwolf5611 жыл бұрын
he is good professor
@johnparaiso381010 жыл бұрын
If you have a recursive function does the user stack keep increasing with each recursive call and then pops all the stack frames when the recursive function ends?
@OmerChoudhry10 жыл бұрын
Thanks for all your help man! ^_^
@Joelych8 жыл бұрын
Hello, how do you write that one message in two lines?? @19:39 Thanks in advance
@AlexEditsBadly10 жыл бұрын
Functions give me cancer.
@princebradly916511 жыл бұрын
u r professor
@aman.kapoor10 жыл бұрын
Kindly answer me the following :- 1) In the getPosInt function, if I return 0;, then my answer comes same as of return num; ...... So what is the difference to note ? Why one should use return num; instead of return 0; or return 1; or return 2; or return 99; ... you know I type any number and it returns the perfect answer. So what is it exactly ? I would be very grateful to anybody who explains me this thing. Thanks. 2) I want to tweak the code. The code taught was capable only if we put integers, then I changed it for real numbers. But I found out that if I put any character or string (due to cin it will take only first letter of string), then the cout
@torieadams1988 жыл бұрын
+Aman Kapoor I am only learning myself so this is the best answer I can give at present time: 1. Return 0 (or whatever) is for the computer to check the program has run correctly, and is only really relevant if you are using more than one program together, for example if you have one program which requests a second program to give it a response - if it returns 0, the program has worked. This could be useful (for example) for switch control. Otherwise it's just good practice to use it. 2. To use any real number, change "int" for "float" and to use any string of word change int for string; You may wish to redefine getPosInt as getPosFloat so it's mathematically accurate. You can use an if statement to return an error message - in a different (but similar) program I wrote the following line: if ((b*b) < (4*a*c) ) {cout