Minggu, 30 Oktober 2011

Iteration in C Language

After studying for the input and output in C language selection in the C language, then the next is loop. Loop on the C language is often referred to as "looping" is a process performed repeatedly until a specified threshold or condition recurrence. Usually when the iteration limit is not included then the syntax would be an error because the process will not stop or overloop-ing.
This type of loop in C Language:
a. FOR
      Syntax: for (initialization; repetition requirements; inkrement or decrement)
                     {
                           ...... action .....
                     }

      initialization: setting the initial state of the control variables
      conditions: boolean expression that determines the end of the iteration
      additions: regulatory changes in the value of the variable control

Example:
for (i = 0; i <5; i + +)
{
printf ("I learn programming with C language algorithms in visualAlpro \ n");
 }

b. WHILE
      Syntax: while (condition) {
                     action}
Example:
i = 0
while (i <5)
{
printf ("I learn programming with C language algorithms in visualAlpro \ n");
 i + +;
}

c. DO - WHILE
      Syntax: do {
                     action ..}
                     while (condition);
      Example:
            i = 0;
  do
            {
                 printf ("I learn programming with C language algorithms in visualAlpro \ n");
                 i + +;
  } While (i <4);

Output for all of them are:
I learned programming with C language algorithms in visualAlpro
I learned programming with C language algorithms in visualAlpro
I learned programming with C language algorithms in visualAlpro
I learned programming with C language algorithms in visualAlpro
I learned programming with C language algorithms in visualAlpro


 The difference between the FOR, WHILE, and DO-WHILE:
For: to repeat a perulanga known exactly how many recurrence.
While: Pre Tested Loop
for looping yet unknown number of recurrence. Checking the condition will be done first before doing the action. If the condition still is true, then the loop will continue until the conditions are false.
Do-while: Post Tested Loop
for loops are not yet known amount. Action will be executed first, and then be checked if the condition is true then it is still looping will continue.

Function in C


After studying input-output in C, selection, and repetition, the more there are functions in C
Function: Part of the program aimed to perform a specific job and the location is separated from the programs that use it. The program of the set of C language functions ofgroups, ranging from the main function, pustka functions, or functions made ​​by theprogrammer.
Benefit functions:
- Features a program that C has a clear structure. By separating the detailed steps to one or more functions, the main function (main ()) will be shorter, clearer and easier to understand.
- The functions can be dijinkan to avoid writing the same repetitive. The measures of the same program and are often used repeatedly can be written once separately in the form ofthe functions, the program requires further steps are enough to call these functions.
The final value of a function is the value returned by the function of the input parameters are entered.


Examples of functions:
int score (int x, int y, int z)
{
return (x + y + z) / 3;
}


Known function of the term in the Formal Parameters and Actual Parameters:
a. Formal parameter is a parameter which is in defining a function.
b. Actual parameter is a parameter which is at the time of the calling function.

Rabu, 26 Oktober 2011

C Programming Language Learning Algorithm: Basic Commands printf - scanf

Basic Commands printf in c programming language is useful to display or print characters written into the screen. While the Basic Commands scanf useful to ask for user input.

Examples of programs:

# Include <stdio.h>
# Include <conio.h>
void main ()
{
printf ("Programming Language C Language Learning with visualALPRO.blogspot.com");
}

The above command is useful for displaying "Learn C Programming Language with visualALPRO.blogspot.com" on the console screen. Unfortunately the above program will display the text in just a short time, so our eyes will be difficult to catch his writings, therefore we must add the getch (); at the end of the program. So that the program would be like this:

# Include <stdio.h>
# Include <conio.h>
void main ()
{
printf ("Programming Language C Language Learning with visualALPRO.blogspot.com");
getch ();
}

Instead the command "printf" is used to retrieve input entered by the user via the keyboard.
Examples of programs:

# Include "stdio.h"
# Include "conio.h"
void main ()
{
char name [20];
clrscr ();
printf ("Enter your name:");
scanf ("% s", & name);
printf ("Hello, Your name is% s", name);
getch ();
}

The above command will print "Enter your name" on your computer screen, obtained from the commands printf ("Enter your name:");

then the program prompts you to enter data via keyboard and data you entered will be recorded scanf ("% s", & name);

and displayed back to "Hello, Your name is visualAlpro" (eg, a name that you type is "visualAlpro")

Perhatikkan! Previously we have declared that the variable name is a character data type with a length of 20 characters by the way: char name [20];

History of C + +




There is a saying that it was love not taxable, so make knowledge alone that we know how the history of c plus plus ..


In 1969, the laboratory BellAT & T in Murray Hill, New Jersey using assembly language is to develop the UNIX operating system. The intention is to create an operating system that can be 'programmer friendly'. After running UNIX, Ken Thompson, a developer
system in the laboratory is developing a new compiler with the name of language B. The letter B is taken from BCPL. Language B is then used to rewrite or revise the UNIX operating system.Because this is still a B language interpreters and slow, then in 1971, then the UNIX operating system written in C language, which is a programming language developed by Brian W.Kernighan and Ritchie Denniss, a developer of the same.


Until now the C language is still used to carry out the development-development programs and operating systems, including Windows and Linux operating systems. The reason is what makes the extremely popular C language programming in the world, especially the software industry. But unfortunately the C language is a language that is still quite difficult to learn because there are purely procedural. To form a single object, we must do a lot of writing code. This certainly would be regarded as a weakness. To overcome this problem, in 1983, a doctor named Bjarne Stroustrup who also works in the same laboratory to create a new language is C + + language which is a language hybrid of C (originally named "A Better C" are then given the name C + + by Rick Mascitti , as for the + + operator increments derived from the C language). C + + language based on C language so that we can compile programs written in C language dalamdalam using C + + compiler. A feature of the language C + + is that this language supports object-based programming, or more commonly known as Object Oriented Programming (OOP). Language C + + classes included in the Intermediate Language.