Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Wednesday, November 10, 2010

How to Become a Professional Programmer?

How to become a professional programmer? Someone who can make a program called a programmer, but whether such a course with someone who can make the program without any fault on the program that was to be called a professional programmer? According to my own, the person is not worth calling a professional programmer. Maybe you are confused why I say like that. That is just my view, maybe you have a view other than mine. Okay, I'll tell someone new programmer is a professional programmer if he has the skills and perform the duties wholeheartedly and without spreading malware or viruses that can cause problems on a laptop computer or the user program.

Friday, October 8, 2010

Details of the test program in C programming language

On the last occasion, I've given the article how to make a simple program with C language, but then I have not provided details of the test program understanding about the commands that I use in making program. Therefore, in this article I will write down the details of the test program.

#include <stdio.h>
Tells C compiler to include the file "stdio.h" in this point of your C program before starting
compile step. This "include file” contains several definitions, declarations etc.

Thursday, September 30, 2010

Create a simple program with C language

At this opportunity, i will start writing articles about how to make a simple program with C language. Today i will give the script the program calculates the area of the triangle.
Note carefully script the following program:

Friday, September 17, 2010

Objects in Ada 83 and Ada 95

Two of the major goals in developing object-oriented software are cost reduction and security. They development of objects as reusable software units aids in the first, while information hiding promotes the second. When objects are created and destroyed dynamically, security update special machine architectures. The design spesifications for Ada 83 did not require object-orientation, but that all type checking and allocatin (binding) of storage for procedures be done at compile time. This is called static binding. Thus we did not find dynamic binding inheritence in Ada 8. By the time the revised standard for Ada 95 [ANSI-1815A, 1983] appeared, experience with both other object-oriented languages and with Ada suggested that security and reliability issues, important for Departement of Defense applications, would not be compromised by adding inheritence and dynamic binding to the language.

Operators of the C Language

Table Operators of the C Language.

Primary Relational
()      Parentheses

x[y]   value of yth element of array x

x.y     value of y field of structure x

Unary
x<y (<,<=,>=)   x less than y,
                                        etc. 0 if false, 1
                                       otherwise
Equality
x==y (x!=y)           x equal (not equal) y

Bitwise (in order of precedence)
!x             not x; !x=0 if x is
                nonzero,1
                otherwise
˜x              1s complement of x.
                 0s become
                 1s and 1s become 0s.
++x(--x)    x is incremented
                 (decremented)
                 before use
x++(x--)    x is incremented
                 (decremented)
                 after use
-x              arithmetic negation of x
*x             value at address x
&x            address of x
sizeof x     # bytes in x

Multiplication
x&y     bitwise and of x and y, 1&1=1,
                   else 0
x^y      bitwise xor of x and y, 1^0=0^1=1,
            else 0
x | y     bitwise or of x and y,0|0=0, else 1


Logical (in order of precedence)
x&&y  1 if both x and y are nonzero, else 0
x| |y     1 if x or y are nonzero, else 0


Conditional
x?y:z      y if x is nonzero, z otherwise

Assignmment
x*y          product (quotient) of x and y
x%y        x MOD y

Addition
x=y        x gets the value of y
xop=y    x gets the value of xopy,
              where op 
              may be +, -, *, /, %, >>, <<, &, ^,
              or |.




Comma
x+y (x-y)  sum (difference) of x
                and y
Shift
x<>y)  x gets left (right) shifted y
                       places
x,y         x, then y, are evaluated,
             expression
             gets value of y
©Hendro Sinaga www.4tatc.co.cc

C has an if  and an if....else statement, as well as repeat, while, do...while...., switch, and for statements.
An example of a C for statement is:

for (i=0;  i<5; i++)  x=i;

The first expression gives a 0 start for the loop, it terminates when i==5, and i is incremented by 1 after it is used (i++). x will be assigned successively: 0, 1, 2, 3, and 4.

Thursday, September 16, 2010

C Programming Language

HISTORICAL VIGNETTE

C (along with its extension C++) has become one of the most popular programming languages around town. It is famous for its amazing duality. It is both a high level programming language and a low level one. It is also both special and general porpose. Unlike some before him, such as the creators of ALGOL, Dennis Ritchie did not set out to develop a popular programming language. How wanted to design a better operating system.
Back in the sixties, Ritchie was a Harvard physics major. After completing his undergraduate work, he specialized in the study of mathematics, like most computer science pioneers. In 1986, he went to work for Bell Labs (now Lucent Technology) and was teamed up with ken Thompson. Thompson, who had grown up with ham radios and chess, received his undergraduate and graduate degrees in electrical engineering from the University of California at Barkeley. The two were given a compelling task: to think about interesting problems in computer science. The duo began to think about OS (Operating Systems).

Wednesday, September 15, 2010

PASCAL

HISTORICAL VIGNETTE
Complexity has and will maintain a strong fascination for many people. It is true that we live in a complex world and strive to solve inherently complex problems, which often do require complex mechanisms. However, this should not diminish our desire for elegant solutions, which convince by their clarity and effectiveness. Simple, elegant solutions are more effective, but they are harder to find than complex ones, and they require more time, which we often believe to be unaffordable. (Niklaus Wirth, Turing Award Lecture, 1984) [Wirth, 1985].

During the mid- to late sixties, ALGOL was the focus of much attention in the world of computer programming. Niklaus Wirth was in the midst of it all, working on improved version of ALGOL 60 at the ETH laboratory in Zurich. The need for a successor versions of ALGOL had become apparent after the release of the Revised Report.

Thursday, September 2, 2010

Historical Vignette Ada Programming Language

In the mid-seventies the DOD, which is not known for its budgetary restraint, was spending approximately $3 bilion a year on sofware. We're all used to seeing such huge figures attached to the military, but in this case the cost was a bit too steep. Something had to be done to lower the software price tag. A large part of the problem was the fact that mire than 450 different programming  languages or incompatible dialects of the same language were being used by the military. This created problems of limited portability from machine to machine, limited reusability of procedures in subsequents programs, and general confusion. The time had come to find a standard language in which all programs for the departement would be written.

Since about 56 percent of the software purchased was used for embedded or mission-critical computer applications. "Much of the computer programming done by the U.S. military is used for controlling military hardware-tanks, airplanes, nuclear bombs. To control such hardware, a computer program must operate in "real-time," that is, while the tank is rolling or the plane is flying.

Structured Data Types

Most imperative languages provide some support for structured types. Users may be able to define their own types, and this can create more meaningful programs. Various types can be combined to create aggregate types, composed of elements of other types, such as arrays and records.
Most programming Languages have at least one built-in type, although there are typeless languages, such as APL and MUMPS, where data objects can be coerced automatically from one type to another. Even here, the programmer is thinking and the program operating on some sort of structured type.

Wednesday, September 1, 2010

Blinding On Programming Languages

The blinding of a variable is the assignment to its attributes: names, addres, type, and value. In order to properly understand the semantics of a language, one should know the binding time of the attributes, whether it is associated at compile, load, or run time. The program source code is converted into machine code at compile time. At load time the relocatable machine code addresses are assigned to real addresses. Associations that occur during execution are said to occur at run time.

A static binding is one that occurs prior to run time and remains fixed troughtout execution. A dynamic binding is one that normally occurs or can change during run time.

Tuesday, August 31, 2010

Variables On Programming Language

When writing in machine code, machine addresses are used to specify where items are to be stored. The programmer has to keep track of what type of object a storage cell contains. Extending this somewhat, a variable provides an abstarction for this notion. A we shall describe shortly, a variable is bound to a tuple7 of attributes: (name, address, type, value). Other important concepts include the scope and the lifetime of the variable, as well as issues of the time of binding, scoping rules, and type checking.

Identifiers

Identifiers or names are not used for variables only. In a program, names may be as signed to such things as procedires,labels,types, and more.
While early languages permitted only single characters as names, most ALGOL like languages permit some string of letters and digits. The string starts with a letter to prevent syntatic confusion, as, for example, between a name like 10x and the integer 10. Names in COBOL, early versions of FORTRAN (through FORTRAN-77), and PL/I were restirected to uppercase letters, but mixed case is normal for many languages. One must be careful to check language rules, however. For example, a FORTRAN-90 compiler may recognize lowercase letters, but is not required to, so continued use of uppercase is common.

Sunday, August 29, 2010

C and UNIX

As we have seen, C is intimately related to the UNIX operating system, whic is written almost entirely in C. UNIX is composed of a kernel, one or more shells, and a large set of service routines. The kernel is small, about 10,000 lines of code, which creaters a virtuals machine that:

  1. Schedules, coordinates, and manages procces execution
  2. Provides system services such as I/O
  3. Handles machine-dependent hardware operations [Silvestre, 1983]
All but the set of machine primitives tailored to the particular computer on which  UNIX is running are written in C. The user rarely sees the kernel, but interacts with the set of procedures comprising one of the shells.

A UNIX system provides a variety of utilities such as editors, debuggers, and preprocessors as well as compilers for BASIC, FORTRAN, RATFOR, PASCAL (at least in the Barkeley version),C, and Assembler. Source code in any of these languages is first translated into C intermediate code before being translated into Assembler, relocatable object, and finally executable machine-language code.

Thursday, August 26, 2010

Variables and Data Types

Imperative Language provide an abstraction for machine code. Variables act as abstractions for memory cells, with names replacing references to machine address. The entry in a cell is associated with some types. Computer languages generally provide some primitive data types, such as charachter and integer. In many cases the data may take some structure, such as an array or record, so such capabilities are also generaly supported.

A variable must be found to the properties associated with it. Aside from its name and associated address, it should be bound to some type and a value. The time of this binding, whether during compilation or execution, becomes important in understanding a language. When we add functions and procedures, we must consider also the scope and lifetime of these variables.

Friday, August 20, 2010

Data Types in C

C has two numeric types, int and float. A real can be double or long double, and an int may be short, long, or unsigned. There is a character type char, but no Boolean type. In C, any nonzero value is considered to be true and 0 false. Since C is close to the machine, certain nonprinting character constants are available, such as \b for backspace.
     Types derived from the simple types above are :
  
     Arrays      : [size]
  Example     : char name [25]


  Pointers    : *
  Example     : int *pn


  Structures  :  struct [<structure name>] {}
  Example     :  typedef struct {int day, month, year;} date;
  Or          :  struct hire_date {int day, month, year;};


Using the typedef for date, we can then declare: date hire_date; and assign its fields as follows:

     hire_date.day = 25;
   hire_date.month = 9;
  (&hire_date) -> year = 1990;


Note here the combination (&....)->.-> is a special symbol meaning "the field of the structure (union) pointed to by the variable on the left." Parentheses are needed around (&hire_date) because -> has precedence over &.


     Unions:   union [<union name>] {list of variants}
     unions are always discriminated, so no ambiguities can occur.  For Example :

Friday, August 13, 2010

Basic Programming C++

History of C++

Talking about C++ are usually not separated from C, as the languge of this prodecessor. C is the programming language that can be said to between low beraras language ( language that is oriented to the machine ) and high beraras language (human-oriented language). C++ was created by Bjarne Stroustrup a decade after C.

Basic Element of C++ :

1. Keyword

Keyword is the identifier that has been defined by the language C/C++ which has a specific meaning and purpose in the program. Keyword is a word reserved ( reserved word ) mean reserved and should not be used for the other purpose.

2. Identifier

Identifier are names the determined by the program makers to deliver a varable name, constanta name, function name, name labels and other objects. General rules applicable in making the identification :