Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: C and Cpp Miscellaneous Basic C++ Functions Tutorial

We have looked at one function already - the ?main? function. Functions are bits of code that the program jumps to in order to do certain tasks. The main function holds the main code (the code that is executed first) and where the other functions are call

Tutorial Details:

Basic C++ Functions

We have looked at one function already - the “ main ” function. Functions are bits of code that the program jumps to in order to do certain tasks. The main function holds the main code (the code that is executed first) and where the other functions are called from. Variables can be passed into and returned from a function.

You can think of functions like the different functions of a calculator. The calculator holds the variables the human inputs and decides what to do with them depending on what the human presses. The calculator calls the appropriate function (in this case we will call it add) and gives the add function the variables the human has given it. The add function then returns the added together variables, and the main code (Calculator) then displays the Variable.

The main code needs no knowledge of how the function works just what the function does. Lets have a go at programming a simple calculator.

First we need to be able to use the “ cout ” and “ cin ” commands:
#include

When we use a function we must tell the compiler that the function exists before the main code is run. We do this through a function prototype, which is declared like a variable.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
C and Cpp Miscellaneous Basic C++ Functions Tutorial

View Tutorial:
C and Cpp Miscellaneous Basic C++ Functions Tutorial

Related Tutorials:

Integrating Databases
Integrating Databases
 
Accelerate your Java apps! - JavaWorld - September 1998
Accelerate your Java apps! - JavaWorld - September 1998
 
Smart object-management saves the day - JavaWorld November 1999
Smart object-management saves the day - JavaWorld November 1999
 
JavaWorld article about JavaCC
JavaWorld article about JavaCC
 
C# : A language alternative or just J--? (part1)
C# : A language alternative or just J--? (part1)
 
Tcl your Java apps - JavaWorld March 2001
Tcl your Java apps - JavaWorld March 2001
 
Integrate Java and C++ with Jace
Integrate Java and C++ with Jace
 
Good introduction to JDO
Good introduction to JDO
 
Let the mobile games begin, Part 2
Let the mobile games begin, Part 2
 
The J2EE 1.4 Tutorial
The J2EE 1.4 Tutorial is a guide to developing enterprise applications for the Java 2 Platform, Enterprise Edition (J2EE) version 1.4. Here we cover all the things you need to know to make the best use of this tutorial.
 
replacing implementation inheritance by contract inheritance
replacing implementation inheritance by contract inheritance
 
Lisp and Java
Lisp and Java In this article, we\'re going to steal an idea from one of the most theft-worthy languages out there: Lisp. We\'re going to pick out one of its most useful features -- the ability to treat functions as data -- and talk about how to apply th
 
JFormula 2.9 - Math expression API
JFormula 2.9 - Math expression API JFormula is a Java library for evaluating various expressions (boolean, math, if/then/else...). A lot of companies chose JFormula like EADS Space Transportation.
 
JTwain
JTwain will implement a Java interface to the the Win32 C DLL TWAIN acquire methods.
 
Servlet Essentials
This document explains the concepts of Java Servlets and provides a step-by-step tutorial for writing HTTP Servlets with complete source code for the example Servlets. The tutorial and the other chapters cover all facets of Servlet programming from a ...
 
10 Minutes Guide to Ant
10 Minutes Guide to Ant 10 Minutes Guide to Ant Previous Tutorial Index Next Introduction Well for the next 10 minutes get ready to devote to the ant guide. This will make some sence to the ant. Ant is a free tool under GNU Licence and is
 
Building Web Application With Ant and Deploying on Jboss 3.0
Building Web Application With Ant and Deploying on Jboss 3.0 Building Web Application With Ant and Deploying on Jboss 3.0 Previous Tutorial Index Next In this lesson I will show you how to build you web application and install on the Jboss 3.0
 
Submit project to get developed
Submit project to get developed T his page contains answers to common questions handled by our support staff, along with some tips and tricks that we have found useful and presented here as questions. How do I Submit my Project ? Who can submit a
 
Parisonz Solutions!
Parisonz Solutions! W elcome to Parisonz Solutions . The purpose of this web is to Develop and Distribute Projects to Businesses and Individuals though Web. We have a wide range of projects completed online — including software development, web
 
Using DTrace to Profile and Debug A C++ Program (Technical Article)
In this test case, the DTrace capability in the Solaris 10 OS is used to identify an error common to C++ applications -- the memory leak.
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.