প্রোগ্রাম Controls করার পদ্ধতি ও তার সঠিক ব্যবহার

Submitted by administrator on Mon, 01/02/2012 - 15:44

Chapter 10 - Getting Controls

 

In Chapter 7, "Doing the Same Thing Over and Over," you learned to use the for, while, and do-while statements to do the same things over and over. These three statements can be grouped into the looping category that is a part of the control flow statements in C.

In this lesson you'll learn about the statements that belong to another group of control flow statements—conditional branching (or jumping), such as

    The if statement
    The if-else statement
    The switch statement
    The break statement
    The continue statement
    The goto statement



Summary

In this lesson you've learned the following:

  •     An important task of a program is to instruct the computer to jump to a different portion of the code according to the specified branch conditions.
  •     The if statement is a very important statement for conditional branching in C.
  •     The if statement can be nested for making a series of decisions in your program.
  •     The if-else statement is an expansion of the if statement.
  •     The switch statement helps you to keep your program more readable when there are more than just a couple decisions to be made in your code.
  •     The case and default keywords, followed by a colon (:) and an integral value, are used in the switch statement as labels.
  •     The break statement can be used to exit the switch construct or a loop (usually, an infinite loop).
  •     The continue statement is used to let you stay within a loop while skipping over some statements.
  •     The goto statement enables the computer to jump to some other spot in your computer. Using this statement is not recommended because it may cause your program to be unreliable and hard to debug.


 

Related Items

The #define and #undef Directives

The #define and #undef Directives

The #define directive is the most common preprocessor directive, which tells the preprocessor to replace every occurrence of a particular character string (that is, a macro name) with a specified value (that is, a macro body).

The C Preprocessor Versus the Compiler

The C Preprocessor Versus the Compiler

One important thing you need to remember is that the C preprocessor is not part of the C compiler.

What Is the C Preprocessor?

If there is a constant appearing in several places in your program, it's a good idea to associate a symbolic name to the constant, and then use the symbolic name to replace the constant throughout the program. There are two advantages to doing so. First, your program will be more readable.

Exercises : Answer the following Question

To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson.

Question and Answer

    Q Why is random access to a disk file necessary?