August 31, 2011

Example 5

Task:
Create programs that require the input of a string. Example: If input = hello
Output:  

hello  
e     l
l      l
l     e
olleh

Code:

 //print "hello" first line
 for a<-1 to Length(sentence),a++
 {
   print sentence[a]
   print newline
 }
 //print the second line of until before the last line
 for a<-2 to Length(sentence)
 {
 print sentence[a]
 for b<-1 to Length(sentence)-2{print space}
 print sentence[Length(sentence)+1-a]
 print newline
 }
 //print "olleh" last line
 for a<-Length(sentence) downto 1,a-
 {
   print sentence [a]
 }

August 29, 2011

Example 4

Task:
Make a program  that require input an integer n:
Example:
If n = 3
Output:
1
2
3
2
1

If n = 4
Output:

1
2
3
4
3
2
1


Code:
input n
For a <- 1 to n do a++
{
  print a + newline
}

For a <- n-1 downto 1 do a--
{
  print a + newline
}

August 28, 2011

Example 3

Task:
Create a program that require input an integer n.
example output:
if n = 5
*****
*****
*****
*****
*****

if n = 3
***
***
***

Code :
input n
For a <- 1 to n
{
  For b <- 1 to n
  {
    print "*"
  }
}

August 26, 2011

Example 2

Task:
Make coding that print an even number of 1 to 100.

Code: 
for n <-- 1 to 100
{
  if (n mod 2) = 0 then print n
}

August 25, 2011

Example 1

Task:
Create an algorithm to display numbers 1-100 provided that:

  • Multiples of 3 is replaced with fizz

  • Multiples of 5 is replaced with  buzz

  • Multiples of 3 & 5 be replaced with fizzbuzz
Code :
for num 1 to 100
if mod 3*5 print fizzbuzz
else if mod 3 print fizz
else if mode 5 print buzz
else cetak num

August 23, 2011

Why Learning by Sample?

During I learned a desktop-based visual programming and web-based, there is an important lesson taken from a learning process. That learning programming is very hard to do if starts with a theory and concepts that are too high.

It will lead novices give up before starting the learning process by immediately imagine how hard it is to learn a programming language. Of course it is very harmful for learners, both in the academic world and professional world.

And after trying various methods, came to a conclusion that was a learning process that is considered the author of today's most effective and efficient is to learn programming in a way just try to make applications from the simplest level to the level of the complex in stages. Method that also often called as Learning by Sample referred to as the already proven to learn a programming language faster and better.

The actual method has been applied also by Microsoft to publish the series HOL (Hands On Lab) featuring examples of programming with a certain level and immediately put into practice by the user. HOL unfortunately is rarely noticed by novice programmers, and still not popular usage for both academia and professional.

C++ Language Tutorial

These tutorials explain the C++ language from its basics up to the newest features of ANSI-C++, including basic concepts such as arrays or classes and advanced concepts such as polymorphism or templates. The tutorial is oriented in a practical way, with working example programs in all sections to start practicing each lesson right away.

Introduction:
Instructions for use
Basics of C++:
Structure of a program
Variables. Data Types.
Constants
Operators
Basic Input/Output
Control Structures:
Control Structures
Functions (I)
Functions (II)
Compound Data Types:
Arrays
Character Sequences
Pointers
Dynamic Memory
Data Structures
Other Data Types
Object Oriented Programming:
Classes (I)
Classes (II)
Friendship and inheritance
Polymorphism
Advanced Concepts:
Templates
Namespaces
Exceptions
Type Casting
Preprocessor directives
C++ Standard Library:
Input/Output with files