cursuri ploiesti, java, programare c++, autocad 2d si 3d, web si programare web
marți, 11 decembrie 2018
c++ programming part one
Definition of OOP by Alan Kay
1. Everything is an object.
2. Objects communicate by sending and receiving messages.
3. Objects have their own memory.
4. Every object is an instance of a class.
5. The class holds the shared behaviour for instances.
6. To eval a program list, control is passed to the first object and the remainder
is treated as its message.
Thank's to Miruna Andreea, who inspired me, and is my lovely daughter, and thank
you for being in my heart
Thank's to Andreea Boroghina, my ex-wife, who support me in the last 22 years, moral
and sometimes, financial
Thank's to my mom and my dad
Thank's to Mr. Bruce Eckel, my model in how to teach other programming
Prof. Engineer Bogdan Boroghina, born on june 9, 1966, is a computer teacher, author,
consultant, programming engineer. His own company Centrul Doxis, provides courses,
ecourses, in entire world, and develop software in Java, C++, Javascript, PHP,
Pascal, Lazarus.
President, Centrul Doxis
visualmindview.blogspot.com
Ebook Publisher, Bucharest, 2018
Thank's to Smashwords, we are now in the entire world, Barnes's & Noble, Kobo,
Apple, BT, Overdrive, and not only.
You decide to be reach. It is must to follow these tips:
Be first, your own teacher, your own guru, mentor.
Decide first, in which area you are the best. Make a simple list, only 2 or 3 items. Let's
say: a. Computer programming b. Algorithms.
Make a choice: what do you like more- "a" or "b" ?
Let's say you choose "a". Because is about Logic, not syntax.
Prepare yourself, in depth.
Start an online bootcamp, on skype, or facebook, or youtube.
Make it free.
Then, you popularize it. On all social networks.
Start it then.
Your age does not matter.
Imagine that you are a sexy teacher and all the students loves you.
Let's learn in the same time with students.
In every day, a lesson.
Make a plan. The big picture.
Example:
Ecourse title: Thinking like a Objetc Oriented Programming, or OOP, or think like a
computer engineer.
Choose the title and the subtitles of the every chapters. Must be keywords in the
chosen field.
By example:
title- What is a programming language?
And the subtitles- human language? and the computer language?
Search on the net the answers.
After that, explain in your own words.
Chapter one: Introduction to programming in C++
Subtitle one: What is a programming language?
Subtitle two: What is an alghoritm?
Subtitle three: What are the main steps to execute a programme
Subtitle one: What is a programming language?
Explain:
As we humans communicate through english language, we also can
communicate with the computer using a programming language.
Just as English has a grammar and a syntax, just o programming language has a
gramar and a syntax.
Subtitle two: What is an alghoritm?
Explain:
An alghoritm is a set of steps, TO DO SOMETHING.
Let's refine: Example:
Let's write an alghoritm to do a tea.
The steps can be:
1. put the water in the bowl
2. put the tea leaves in the water
3. light the fire
4. i'm waiting to boil
5. take the boil
6. drink the tea
Ask:
The order of the steps counts?
Answer: Sometimes yes, sometimes no.
Other example:
1. drink the tea
2. put the water in the bowl
3. put the tea leaves in the water
4. light the fire
5. i'm waiting to boil
6. take the boil
It's impossible. I cant't drink the tea, because it's doesn't exist!
So, sometims orders count.
But:
1. put the water in the bowl
2. light the fire
3. put the tea leaves in the water
4. i'm waiting to boil
5. take the boil
6. drink the tea
It's possible, so, oder does not matter, in this case.
So, in C++ and Java, is not about syntax, it's about logic.
One day, I sent Andreea, the girl I was living with, to buy her sunglasses. and asked
the sellers: Do you have sunglasses? For whom, for the sun? asked the seller? Not,
for me, he said. And here the Andreea's answer was not wrong, but how the question
was asked.
Subtitle three
What are the main steps to execute a program?
Answer:
Step1: write the source code
Step2: compile the source code, in order to transform the source code in
machine code, and verify the source code to the syntax error
Step3: execute the program, to verify the program to the logic error
Step1:
It's indicate to write the program first of all, in pseudocode (false code).
a. analyse the problem
a1. understand the nature of the problem
a2. break the problem down into small parts
a3. define the problem goals
Every problem must have: input data, output data, and input data processing to
obtain output data
Example:
We know the sides length of a triangle. Let's write a C++ program to calculate the area
of the triangle.
a. analyse the problem
a1. understand the nature of the problem
Of course, is a math problem.
a2. break the problem down into small parts
The sides length of a triangle
a3. define the problem goals
To calculate the area of the triangle
Has we know, every problem must have: input data, output data, and input data
processing to obtain output data
In this case, input data will be: the sides length of a triangle.
In this case, output data will be: the sides the area of the triangle.
In this case, input data processing to obtain output data will be: Heron's
formula.
All data, wether input or output, must be retained in memory areas, called
variables.
Variable
What is a variable?
Think of a variable like a box, or why not, a room. The room have an adress.
It's a memory location where data can be retained.
On the camera door write a name.
Just us when we were born we got a name, so the variables must be named
before they are used. Process is called the declaration of a variable.
In the example above, the name will be "A".
Inside to the "A" variables, we can have a value. An unique value. We can't have two
variables with the same name.
called so (variable), because during the execution of the program, the value can be
change.
The name is made up of digits, letters and a character _ (underscore), and
always begin with a letter or character_.
Big letters are different from small ones. C++ is case sensitive.
In the room we can store the name a man.
string name="bogdan";
A variable can only retain data of a particular type.
Before using, any variable must be declared.
The statement of type declaration has the form:
type list_of_the_variables;
The list of variables is made up of separate variable names of commas.
int a;
char b;
declares a variable of type int (in which numbers can be retained) and a variable
b of the char type (which can retain characters: numbers, uppercase letters,
lowercase letters, etc.). According to the statement of declaration of the above
type, several variables of the same type may be declared with a single
statement, writing their names separated by commas. For example, the
statement:
int n1, n2;
Declaration of a variable must end with the sign ";" and in this case we declare two
variables of int type. A variable can be initialized when we declare her type.
For example, the statement:
int d = 1;
declare an int variable that initializes it at value 1.
Abonați-vă la:
Postare comentarii (Atom)
Niciun comentariu:
Trimiteți un comentariu
Rețineți: Numai membrii acestui blog pot posta comentarii.