C Loops and Decision Explained with Examples
Hello friends, now I want to share a little bit about what I had learned yesterday about Programming Concepts.
So, in the matter last week, I discuss the Conversion, Decision, Function, Array, Looping.
but, here I'll repeat a little discussion about the looping and decision .
- Looping
In programming languages, looping is a process that is done repeatedly until the specified limits,
and there are three ways to do looping in c ++, using
- For
- While
- Do-While
So friends lets make a simple program uses looping in c ++
- For
- While
- Do-While
So, the difference between the FOR, WHILE, and DO-WHILE:
- For:
To repeat the process a known amount.
- While:
To repeat the process as yet unknown amount.
at the first check will be performed if the condition is true then the loop will continue
- Do-while:
To repeat a process that is not yet known amount.
Instruction is executed first, and then check the condition
if they are true then the loop will continue
Explanation
Repetition will be conducted from 0-10, meaning there 11x repetition.
Meaning of variable x = 0 is the initial value of x is 0.
Meaning x <= 10 is the maximum repetition is done is up to 10.
Meaning x ++ is the added value of each repetition is already in execution,
Her example if we had put the value at x [0], it will immediately go to x [1]
and so on up to x [10].
-------------------------------------------------------------------------------------------
- Decision
So friends lets make a simple program uses looping in c ++
- If-Else
Explanation
If - Else = "if true, the commands will be done according to the order, and if it does not qualify to true then the command will be routed using else"
- Switch-Case
Explanation
Decision-making that involves a lot of ways settlement.
-------------------------------------------------------------------------------------------
Finished friends, this is a simple program in c ++, I'm sorry if it is less clear in his explanation because I am still a beginner and learning stage.





















