Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Compiler
A compiler is a computer program which helps you transform source code written in a high-level language
into low-level machine language. It translates the code written in one programming language to some other
language without changing the meaning of the code. The compiler also makes the end code efficient which
is optimized for execution time and memory space.
Most high-level languages will include their own compiler or have toolkits available that can be used to
compile the program. Two popular compilers are Eclipse for Java and DEV C++ for C and C++. Depending
on how big the program is, it should take a few seconds or minutes to compile. If no errors are encountered
while being compiled, an executable file is created.
Editor
Editors or text editors are software programs that enable the user to create and edit text files.
In the field of programming, the term editor usually refers to source code editors that include many special
features specifically designed to simplify and speed up typing of source code, such as syntax highlighting,
indentation, autocomplete and brace matching functionality. These editors also provide a convenient way
to run a compiler, interpreter, debugger, or other program relevant for the software-development process.
So, while many text editors like Notepad can be used to edit source code, if they don't enhance, automate
or ease the editing of code, they are not source-code editors.
Example: Notepad, Notepad++, Eclipse Editor, Dev C++ Editor
Programming productivity is increased. One line of 4GL code is equivalent to several lines of
3GL code.
System development is faster.
Program maintenance is easier.
The finished system is more likely to be what the user envisaged, if a prototype is used and the
user is involved throughout the development.
End user can often develop their own applications.
Programs developed in 4GLs are more portable than those developed in other generation of
languages.
Documentation is improved because many 4GLs are self documenting.
Disadvantages:
The programs developed in the 4GLs are executed at a slower speed by the CPU.
The programs developed in these programming languages need more space in the memory of the
computer system.
In this C++ programming “If-else” and “switch” both are selection statements. The selection statements,
transfer the flow of the program to the particular block of statements based upon whether the condition is
“true” or “false”. The fundamental difference between if-else and switch statements is that the if-else
statement “selects the execution of the statements based upon the evaluation of the expression in if
statements”. The switch statements “selects the execution of the statement often based on a keyboard
command”.
Comparison Chart
Example of IF ELSE statement:
1. int c;
2. cout<<" choose the value from 1 to 3"; cin>>i;
3. switch( i ){
4. case 1:
5. cout<<"you choose dark choclate";
6. break;
7. case 2:
8. cout<<"you choose candy";
9. break;
10. case 3:
11. cout<<"you choose lollypop";
12. break;
13. .
14. .
15. default
16. cout<<"you choose nothing";
17. }
Output: 0 1 2 3
This example jumps out of the loop when i is equal to 4:
C++ comes with libraries which provides us with many ways for performing input
and output. In C++ input and output is performed in the form of a sequence of
bytes or more commonly known as streams.
Input Stream: If the direction of flow of bytes is from the device(for example,
Keyboard) to the main memory then this process is called input.
Output Stream: If the direction of flow of bytes is opposite, i.e. from main
memory to device( display screen ) then this process is called output.
Example:
#include <iostream>
using namespace std;
int main()
int age;
return 0;
}
Input is : 18
Output is :
Enter your age:
Your age is: 18
Program Life Cycle
Stage 4: Linker:
As the name suggest it links multiple object file in to single executable file .exe this is ready to be loaded
in memory. At advance level there will be multiple source codes for a single program there you have link
all to make one .exe file.
Stage 5: Loader:
At this stage executable file is loaded in to RAM (Read only memory). It’s basically a program of operating
system that allocate this memory space and transfer control to beginning of instruction.
Stage: CPU:
At this stage program is executed. If there is some input from peripherals then it waits for your input and
after that it shows your desired result. While giving data through peripheral if there is mistake then whole
program will stop and will start again from stage 2. For Example in program there was instruction of getting
integer from peripherals but input was a non-integer. So it will give error until you clear.
Editor Preprocessor Compiler
While Loop:
A while loop is a control flow statement that allows code to be executed repeatedly based on a
given Boolean condition. The while loop can be thought of as a repeating if statement.
Syntax :
while (boolean condition)
{
loop statements...
}
Flow Diagram
Example:
#include <stdio.h>
int main()
{ int i = 5;
printf("GFG\n");
i++; }
return 0; }
Do While Loop:
do while loop is similar to while loop with the only difference that it checks for the
condition after executing the statements, and therefore is an example of Exit Control
Loop.
Syntax:
do
{
statements..
}
while (condition);
Example:
#include <stdio.h>
int main()
{ int i = 5;
do {
printf("GFG\n");
i++;
return 0; }
WHILE DO-WHILE
while(condition) while(condition);
Variable in condition is initialized before the variable may be initialized before or within the
while loop is entry controlled loop. do-while loop is exit controlled loop.
A Willingness to learn
This is a trait that is highly overlooked by applicants when technology is always evolving and the
skills and abilities a programmer has today will likely be outdated in a few years. It’s important to
be a programmer who has an interest in keeping up with the latest trends and is eager to take any
opportunity to learn new skills and improve existing ones.
Problem-solving skills.
Great developers are usually independent and amazing self-learners. They have the ability to
learn new technologies on their own and aren’t intimidated by new challenges. For those who
have never attempted to create an application from scratch, programming can best be compared
to solving an extremely difficult math equation. A good programmer thrives on being innovative
and finding ways to make something work, despite the odds.
Communication Skills
Good communication skills directly correlate with good development skills. A great developer is
able to understand problems clearly, break them down into hypotheses and propose solutions in
a coherent manner. They understand concepts quickly, or ask the right questions to understand,
and don’t need to have everything written down specification document. Great offshore
developers usually speak multiple languages coherently and are very comfortable with
documentation in English.
Debugging skills.
Creating code is only part of a programmer’s job. When software doesn’t work as expected, a
programmer is expected to get to the root of the problem quickly and effectively. Instead of
spending hours blindly making changes, search for a programmer who prefers to carefully
investigate his code and research possible issues until an answer is found.
Constraints
Every project or job has several constraints whether it be time or budget. A good programmer
knows how to code in terms of time and space complexity. Since budget is really important in a
lot of projects, a good programmer will create a software using fewer resources. A good
programmer knows how to manage the project requirements and is very flexible.
It is good to learn about the history of C programming. C was developed and written
by Dennis M. Ritchie in the year 1972, and hence he is known as the founder of C.
During the late 1980s, C was started to use for a wide variety of mainframe computers,
micro and mini computers which began to get famous. Gradually C got its superset -
i.e., C++ which has added features, but it's developed from C with all its initial concepts.
Arrays:-
When there is a need to use many variables then There is a big problem because we will
Conflict with name of variables So that in this Situation where we wants to Operate on
many numbers then we can use array . The Number of Variables also increases the
complexity of the Program. So that we uses Arrays.
Arrays are Set of Elements having same data type or we can Say that Arrays are Collection
of Elements having same name and same data type But Always Remember Arrays are
Always Start From its index value and the index of array is start From 0 to n-1.
Suppose we wants to Access 5th Element of array then we will use 4th Element Because
Arrays are Start From 0 and arrays are always stored in Continuous Memory Locations
The Number of Elements and Types of array are Identified by Subscript of array Elements.
The Various types of Array those are provided by c as Follows:-
1. Single Dimensional Array
2. Two Dimensional Array
3. Three Dimensional array
4. Character Array or Strings.
In this first 3 represents the total number of Tables and the second 3 represents the total
number of rows in the each table and the third 3 represents the total number of Columns
in the Tables
So this makes the 3 Tables having the three rows and the three columns
The Main and very important thing about the array that the elements are stored
always in the Contiguous in the memory of the Computer
4) Character Array of String: -Like an integer characters are also be in the Array The
Array of Characters are called as the Strings They are Generally used for representing the
Strings Always Remember that a String is Terminated with the \0 or Null Character
It declares the 5 names and each having the characters up to 10 So the First Subscript is
used for defining the total number of the Strings and the Second is used for Length of the
Characters
Pointer and Structure
Pointers:
Example:
// C++ program to illustrate Pointers in C++
#include <bits/stdc++.h>
using namespace std;
void geeks()
{
int var = 20;
Output:
Value at ptr = 0x7ffcb9e9ea4c
Value at var = 20
Value at *ptr = 20
Strcuture:
A Structure in C++ is a group of data elements grouped together under one name. These data
elements, known as members, can have different types and different lengths. It is a user defined
data type which allows you to combine data items of different kinds.
Imagine you want to store details of a person for e.g. his name, age, height, date of
birth and weight. In a typical scenario you will have to create 5 variables to store these values, but
what if you have to store details of 20 people. Then you will have to create 100 variables and that
will be very tedious and inefficient. In such scenarios we can create a struct datatype
named Person and include all the details as member variables of this datatype to create a custom
datatype. We can then simply create 20 variables of this new structure datatype or a single array of
size 20.
Example:
To access any member of a structure, we use the member access operator (.). The member
access operator is coded as a period between the structure variable name and the structure
member that we wish to access