Keanehan dan keunikan yang ada di dunia

03 November 2009

Variables. Data Types

The usefulness of the "Hello World" programs shown in the previous section is quite questionable. We had to write several lines of code, compile them, and then execute the resulting program just to obtain a simple sentence written on the screen as result. It certainly would have been much faster to type the output sentence by 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 variable.

Let us think that I ask you to retain the number 5 in your mental memory, and then I ask you to memorize also the number 2 at the same time. You have just stored two different values in your memory. 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. Values that we could now for example subtract and obtain 4 as result.

The whole process that you have just done with your mental memory is a simile of what a computer can do with two variables. The same process can be expressed in C++ with the following instruction set:

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.

Therefore, we can define a variable as a portion of memory to store a determined value.

Each variable needs an identifier that distinguishes it from the others. For example, in the previous code the variable identifiers were a, b and result, but we could have called the variables any names we wanted to invent, as long as they were valid identifiers.

http://www.cplusplus.com/doc/tutorial/variables/

Tags

10 fakta unik 12-12-2012 17 + 5 fakta unik 6 fakta unik 7 fakta unik 8 fakta unik 9 fakta unik adegan ranjang ajaib akhir zaman alien alien di bumi aljabar linear all about cinta aneh anime antivirus artis barat artis china artis dalam negri artis dunia artis hot artis india artis jepang artis lucu artis pendatang baru award babi aneh banci banten Belajar PHP bencong berita berita dewasa berita indonesia berita terbaru berita unik bertta bintang film porno bintang porno jepang blog tutorial bocah unik boneka terseram buaya panjang 12 m C++ cantik cari uang mudah cewek cantik cewek facebook cewek nekat cewek panggilan cewek rusia Cheerleader Contact curhat dapat uang 10 - 15 juta perbulan. desa terapung desain unik dewasa djarum black competition f facebook fb cewek cantik fenomena alam film film indonesia finalis miss indonesia 2013 foto artis foto HOT foto lucu foto panas foto unik ga gadis gadis cantik gambar artis lokal gambar artis luar gambar berbahaya gambar HOT gambar lucu gambar sexy gambar unik game game indonesia game seru hack handphone terbaru hewan aneh hewan berbahaya hewan unik honey moon Hujan yang aneh indonesia unik IT jadul jav java jepang jepang unik jual septic tank kamus bencong kamus waria kanibal karya unik keajaiban Tuhan keanehan dunia keberadaan alien kelakuan pria kesehatan keunikan alam keunikan hewan keunikan manusia kiamat kiamat 2012 koleksi foto tasya djerli komputer kota terunik kota unik kreatif kucing berdoa kuliner lab Algoritma laptop jadul lirik lagu lorong waktu luar biasa luna maya maho makanan makanan aneh makanan unik manusia hebat manusia liliput manusia raksasa manusia unik maria ozawa materi kuliah mengapa pesawat sukhoi jatuh? pramugari pesawat sukhoi mengerikan Mesin waktu mey meydiana sari miss banten miss indonesia miss indonesia 2013 miss indonesia meydi misteri mistis motivasi nekat payudara penampakan alien Penemuan pengetahuan umum penghargaan nobel penghasilan penyakit aneh penyebab pesawat sukhoi jatuh perwakilan banten pesawat sukhoi pesawat sukhoi jatuh pohon aneh pria maho ramalan dunia ramalan kiamat renungan reseller rin sakuragi rohani rumah unik sejarah sejarah windows selebritis septic tank septic tank biological septic tank fiberglas septic tank modern septic tank murah septictank bio seputar hantu seram sora aoi spiteng fiber spiteng fibreglass tahukah anda tangki septic tank tato 3D teknologi terbaru tikus jadi ayam tips and trik blog tips kesehatan tips unik tumbuhan unik tutorial facebook unik unik-unik video porno waria windows 8 wisata kuliner

TaTTiTTuT Blog Copyright © 2011 | Template created by O Pregador | Powered by Blogger