Hi. I am studied Software Engineering in university of Kelaniya. I love to write new programs using new programming languages. Fist I studied C language in my first semester. Fist time I started to study, it was very difficult to me. In second semester I study Java language for Object Oriented Programming. It is easy to me because I understand the fundamental of the programming and the using of the structure to solve the problems. The algorithms and pseudocode really help to write the big program.
In the structure programming clearly learn the three structures is very helpful to me. The 3 structure are here.
1.Sequence structure
2.Selection structure
3,Repetition structure
If you understand how these structures are working, then you can create your own program very easily. In most of the language we can use this structure. These structures are the basic to the language.
The Sequence structure is the flow of the program we write. It run the codes which order we write. This is the Sequence structure.
The Selection structure is the code run when a condition is true or false. E.g: if, if-else , switch statements we can said.
if(condition)
{
statement; // run if the condition is true
}
else
{
statement; //run if the condition is false
}
we can said that if is a single selection statements, if-else is double selection statements and switch is the multiple selection statements. If we want to run multiple statements for a condition is true then we can use nested({}) statements. It help to run multiple statements for a condition is true. In the switch statements we use "case" to decide condition, "default" use to run the statements for the default conditions and "break" use to the differentiate other cases. If we use the default case in the last then we don't need to put "break" for that default case. otherwise we must put the "break".
The repetition structure use to run loop in the program. E.g: for, while, do-while are use to run the loop.
for(initialization; condition; increment or decrement )
{
statement; //run until the condition is false
}
initialization;
while(condition)
{
statement; //run until the condition is false
increment or decrement;
}
do
{
statement; //run until the condition is false
increment or decrement;
}while(condition);
In every repetition statements have initialize variable for run the loop, condition to exit the loop and increment or decrement to make the condition false when we want.
These are the three structure. How we know these three structures very well we can easily write our program.
Good one bro...
nice continue......