Eelo Programmers
14/12/2016
Variables and types
The usefulness of the "Hello World" programs shown in the previous chapter is rather questionable. We had to write several lines of code, compile them, and then execute the resulting program, just to obtain the result of a simple sentence written on the screen. It certainly would have been much faster to type the output sentence ourselves.
However, programming is not limited only to printing simple texts on the screen. In order to go a little further on and to become able to write programs that perform useful tasks that really save us work, we need to introduce the concept of variables.
Let's imagine that I ask you to remember the number 5, and then I ask you to also memorize the number 2 at the same time. You have just stored two different values in your memory (5 and 2). Now, if I ask you to add 1 to the first number I said, you should be retaining the numbers 6 (that is 5+1) and 2 in your memory. Then we could, for example, subtract these values and obtain 4 as result.
The whole process described above is a simile of what a computer can do with two variables. The same process can be expressed in C++ with the following set of statements:
1
2
3
4
a = 5;
b = 2;
a = a + 1;
result = a - b;
Obviously, this is a very simple example, since we have only used two small integer values, but consider that your computer can store millions of numbers like these at the same time and conduct sophisticated mathematical operations with them.
We can now define variable as a portion of memory to store a value.
Each variable needs a name that identifies it and distinguishes it from the others. For example, in the previous code the variable names were a, b, and result, but we could have called the variables any names we could have come up with, as long as they were valid C++ identifiers.
Identifiers
A valid identifier is a sequence of one or more letters, digits, or underscore characters (_). Spaces, punctuation marks, and symbols cannot be part of an ident
07/12/2016
PHP Programming.....
PHP is a server-side scripting language designed
primarily for web development but also used as a
general-purpose programming language . Originally
created by Rasmus Lerdorf in 1994, the PHP
reference implementation is now produced by The
PHP Development Team. PHP originally stood for
Personal Home Page, but it now stands for the
recursive acronym PHP: Hypertext Preprocessor .
11/05/2014
Are you Programer ?
What is an Error?
How solve an Error ?
When the error is ?
04/05/2014
which language do u want to be a professional
Click here to claim your Sponsored Listing.
Category
Website
Address
Istanbul