Subscribe To Our Newsletter

Sign Up Now To Get Free Coupon Codes, Event Coupon Codes Updates, Offers Updates. It's 100% Free!

We Hate Spam! Really, It's terrible and we never do it.

C++ | Return Value in Function | Lecture 6

return value in function

Lecture # 6:

Here you will learn that how to return value in function in C++ programming?
It is a very useful way and important way. You will use it in your programming many times. It works with user define functions. Let's try it.
Here we take dog year example.

 /*  
  Name: Return Value in functions  
  Copyright: SameeArticles.blogspot.com  
  Author: Samee Ullah Feroz  
  Date: 24/02/14 16:17  
  Description: How to return value in function in C++?  
 */  
 #include <iostream>  
 #include <cmath> //it is for all math functions library  
 int dogyears(int); //it is int function and return int   
 int main() //it is actually a function here  
   {  
    using namespace std;  
    int years; // user define variable  
    cout << "enter your dogs age: ";  
    cin >> years;  
    int peopleyears = dogyears(years);  
    cout << "your dog is " << peopleyears << endl;  
    system("pause");  
    return 0;  
   }   
 int dogyears(int dog) //User define function.  
 {  
   return 7 * dog; //it will return a value a variable  
 }  
Share this article :

Post a Comment

Give your reviews about this blog. Leave your comments. what do you think about this post?

Comments Description is given below:
1) I love to read comments, but do not spam.
2) Like this blog and also tweet its posts.
3) You can use some xHTML tags.
4) All Comments are Do Follow, Please try to use blog professionally.
5) Mention Your Name below the comment.
6) You can also suggest for improvement.
7) Do not forget to subscribe Samee Articles blog.

---------------------------------------
Thanks for visiting QWC.Me.
==========================================
For free guidelines contact me on SEO Expert | Samee Ullah Feroz is online there.
==========================================
Best Regards

 
Support : | Internet Marketing Specialist And Business Developer
Copyright © 2013-2016. Samee Articles - All Rights Reserved
Proudly powered by Blogger