Computing and Programming Computers

Before we go into detail about C ++, we need to really understand what computing is, and specifically, computer programming.

Computers and Computers

Have you stopped to think about what is computing?
Or what is a computer?

These words derive from the word compute, which basically means counting, calculating.

And that's what a computer is, a calculating machine. But an incredible machine, capable of millions of calculations in fractions of seconds.


It is worth noting here that Computer Theory is a branch of Mathematics.
That is, computing is something purely mathematical, we will work with reasoning, creativity, concentration ... we will seek solutions to problems, creating logic (algorithms, ways to solve problems).

As we will see throughout our C ++ course, the computer is a perfect machine to do storage and data processing, the two pillars of computing.

Computer programming

The hammer is the mason's tool.
The saw, the joiner.
The doctor, the scalpel.

Is the computer programmer's tool? Yes, but also the secretary, the employees of a company, the shops of the merchants, the operators of the stock exchange ... it is so useful that the computer has to be difficult to say whose main tool it is.


And this is due to one reason: programming.
Computers are programmable, you can adapt it for a multitude of different purposes, through computer programming.

Being more specific, the computer is a machine that obeys commands.
And here comes the secret: these commands, or instructions, are given by a programmer.

So, if you know how to program, you will have the power to make the computer obey your commands, to do literally anything, it all depends on your imagination (and programming skills).

Hardware and Software

Every computer has two categories: hardware and software.


The hardware refers to the actual physical components of the computer that you can see and touch.
Although we speak 'computer' as a single device, it is actually a set of hardware, where the main devices are:

  • CPU - Central processing unit, the 'heart' of the computer, is where the instructions will 'happen'. Basically, the CPU receives some input information, does some sort of processing, and returns an output.
  • Memory - Device that save, stores information. Have you noticed that you download a file, turn off the computer and when you turn on those files are still there? Well, for that to happen they need to be 'stored' somewhere, in the case, in the memory.
  • Input Devices - These are hardware that will send information to the CPU, such as the keyboard (each key you press, a command / information is sent), mouse (position of it, the act of clicking etc), joysticks etc.
  • Output Devices - They are the hardware responsible for sending information, from the computer to the outside world. The most classic example is the monitor, which displays information for you. Printer is also an output device (output information on the sheet of paper)


Already the software is nothing more than the program running on your computer.
It is abstract, you can not 'see' it, only its result. It exists in the form of bits of information on your machine and you do not see these bits.

The main software of a computer is undoubtedly the operating system (such as Windows and Linux), which is the program responsible for dealing with the hardware and information received from the user.

Programming language

You already know a language, English.
What can you do with it?

You can write books, texts for websites, use the English language to make signs, billboards, magazines, newspapers, let the language be used on TV, on the cell phone, we use to communicate, talk ... finally, a multitude of things.

Programming language is the same thing, a language. But it is the language we use to communicate with a computer.
We can not do: "Hey computer, do a game that is like this and so"

Obviously it will not understand, but if you use a programming language (like C ++, one of the best, most important and powerful), it will understand.

With the programming language, we can create specific instructions for the computer to obey, we can create images, videos, graphic arts, menus, buttons, programming systems of cars, aircraft, games, system for electronics such as refrigerators, microwaves, etc etc etc. ..the possibilities are endless too.


C ++ programming language
Example of a code snippet of the C ++ programming language

Computer program

A computer program, or software, is nothing more than a set of instructions that your computer must follow to accomplish some task.

Let's assume you want to create a program that displays the price of a product in a store, but at a discount. Your computer should follow the following steps, in order:

  1. Ask the price of the product
  2. Apply discount (mathematical calculation)
  3. View discounted product information


Our C ++ code, applying a 10% discount, would be:
#include <iostream>
using namespace std;

int main()
{
 int price, price_with_discount;
 cout << "How much does the product cost?";
 cin >> price;
 price_with_discount = price * 0.9;
 cout << "Price with discount: " << price_with_discount << endl;
 return 0;
}

The result displayed to the user would be:
C++ Programming language


How to be a good C ++ programmer

Did you learn English in a few weeks? Or months?
Of course not.

So, with the C ++ programming language, it's the same thing.
Let's start slowly, very basic, as if we taught the vowels, then the consonants, then join and form some syllables ...

With the English language you can both create the next classic of literature, as you can write a horrible and poor lyrics songs. It will all depend on one thing: how much you study.

There is no mystery: it's to sit in your chair and study, think, think, think a little more, try ... you're going to make a mistake, until today I make mistakes and all the best programmers miss a lot, it's practically impossible to create a program. reasonable postage without several problems, which we call bugs.

Do not give up. You can cry in a fetal position, okay, it's a part. But then come back and try again, that's how you learn. The more you study, try and devote yourself, the better programmer will be.

And it's no use just reading. If you only want to read this course, you are wasting your time.
You have to practice, put your hand in the dough and try to program, okay?

Do not try to copy and paste anything, write everything in hand, try to make your own solutions.
There is no 'way to create such a program' or 'step by step to create a game', each programmer does it his own way, just as each human does a writing in his own way.

Sources of study

Computer
Theory of Computation

No comments:

Post a Comment