More Functions

From Wikiversity

Jump to: navigation, search
Please help develop this page

This page was created, but so far, little content has been added. Everyone is invited to help expand and create educational content for Wikiversity. If you need help learning how to add content, see the editing tutorial and the MediaWiki syntax reference.

To help you get started with content, we have automatically added references below to other Wikimedia Foundation projects. This will help you find materials such as information, media and quotations on which to base the development of "More Functions" as an educational resource. However, please do not simply copy-and-paste large chunks from other projects. You can also use the links in the blue box to help you classify this page by subject, educational level and resource type.

Run a search on More Functions at Wikipedia.
Search Wikimedia Commons for images, sounds and other media related to: More Functions
Search for More Functions on the following projects:
Lost on Wikiversity? Please help by choosing project boxes to classify this resource by:

functions are building blocks of C++ A function is a named part of a program that can be invoked from other parts of the program as often needed.Consider the following program that accepts a number and prints its cube:-

#include<iostream.h>
using namespace std;

float cube(float);

float cube(float a)
{
return a*a*a;
}

int main()
{
float num;
cout << "Enter a number:";
cin >> num;
cout << "The cube of" << num << "is " << cube(num)<< "\n";
system("pause");
return 0;
}


output of the program will be-

Enter a number : 19

The cube of 19 is 729

[edit] Where To Go Next

Topics in C++
Beginners Data Structures Advanced
Part of the School of Computer Science
Personal tools