Archive for September 2016
Decision Making, Looping, Array, & Function
By : UnknownDecision Making, Looping, Array, & Function
Hi Guys, in this post we will learn about "Decision making, looping, array, & function", so first of all, let's explain what is it .
Decision making
Decision making , just like the name, it's about making a decision of what order we will make to our program. For example execution of statements based on certain conditions or repeat it until certain specified conditions are met.
Looping
Just like the name, looping is an instruction to do something over and over until the determined limit.
Array
Array is a group of variabel that has the same data type, it is usefull for saving data and object reference in large number
Function
Function is a part of program that use to do spesific task.
So, we already learn about what is the definition of these guy. Next we'll learn about how to use it in our program ^^
Decision Making
There are 3 type of Decision making
- if
- if-else
- switch
If
If use to program to execute a certain part of code only if particular condition is true
Example :
and the result is ....
Else if
Just like if, else if is use to execute one block of statement among two blocks.
Switch
Switch statement work with byte, short, char, and int primitive data type
for example :
and the result ..
Looping
Looping is an intruction to make program do something several times, it is very usefull if u need to do something over and over.
there are 3 kind of looping
- While
- Do while
- for
While
While will check the instruction first then do the loop, if there's no correct condition, it will end nothing
Do While
Do while, different from while, it will do the looping first
For
It allows you to controll and write specific loop that need to execute
Here's a example of looping
the result ..
Array
Because we already know what is array at the beginning of the post, i ll give you example of Array
and the result ...
Function
Just like what we learn at the beginning, function is a program that do specific task, we can call it sub-program , for the example is "int main" and all programs that can define additional functions.
Alright that's my post today ^^, hope you enjoy it.
Bye byeee
How to Install Dev C++ and writing a program
By : UnknownHow to Install Dev C++
Hi guys, today i will tell you about how to install a program , the program is Dev C++. Check it out ^^
What is Dev C++ ?
Dev C++ is an aplication for writing and compile program. It made for programming in C and C++
How to Install Dev C++
1. Download the Dev C++ Installer, you can download it here : https://sourceforge.net/projects/orwelldevcpp/
2. If the download already finish, open the installer
3. Choose languange you want to use , then click "OK"
4. Read the license of agreement and click "I Agree" to continue the installation
5. Choose the component you want to install, i recomend to install all the component , and then Click next
6. Choose the destination folder, where will you want to keep the Dev C++ file. Usually it will automatically browse at Disk C. After you choose, Click Install
7. The program will be installing now, wait for the installation to finish
8. Finish ! Now you can use Dev C++ to writing program and compiling program
Writing a program in Dev C++
Now that the installation already finish, now you use Dev C++ to write program and compile it. Lets try to make a simple instruction say " Hi, welcome to baimsmk blog", i will explain how to do it
1. First, you need to make a new project. Click file tab then choose project
2. Then, write down your program at the new project you just made
#include <stdio.h> is an instruction including standard input output so we can use the instruction
main : in C languange we must put main before start writing the instruction
printf : is an intruction to print the word inside the double quote
return 0 : it mean the program already finish, and return to 0
3. After finishing the writing, we should compile & run it, it on execute tab.
4. You can see if there are errors in your program in compile log
5. And, that's it we already finish it, you can see the "Hi, welcome to baimsmk blog" is printed
Thankyou for reading this post, i hope this can help you ^^
Byeeeee