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
}

Post a Comment
Give your reviews about this blog. Leave your comments. What do you think about this post?
Comments Guidelines:
1) I love to read comments, but please avoid spam.
2) Like this blog, share your insights, and spread the word.
3) You can use basic HTML/xHTML tags.
4) All comments are DoFollow—please use the section professionally.
5) Kindly mention your name or brand below your comment.
6) Constructive suggestions for improvement are always welcome.
7) Do not forget to explore our main agency platform at pingbooster.site.
Thanks for visiting Samee Articles.
========================================
Explore custom digital solutions and WordPress plugins at PingBooster Plugins.
Best Regards,
Samee U. Feroz