Basic Control Structures
Control structures are fundamental to
structured programming languages, including C, C++, Java, newer versions of
Fortran, Basic, etc. You should know what the different types of control
structures are and how they are implemented in the programming languages you
use.
- Control Structures
- If Structures
- While Stucture
- Counter-Controlled Repetition
- Sentinel-Controlled Repetition
- Nested Control Structures
- Assignment Operators
- Increment and Decrement Operators
- What are the 3 types of fundamental
control structures in structured programming?
- If (Selection) Structure
1. What is the format of a simple "if" structure?
2. What is the format of the "if/else" structure?
3. What is the "else-if" structure?
- While (Repetition) Structure
1. What is the format of a while loop?
2. How is the while loop used to implement a counter-controlled loop?
3. How is the while loop used to implement sentinel-controlled
repetition?
4. What are nested control structures?
- Assignment operators and
Increment/Decrement operators
1. What assignment operators are provided?
2. What increment and decrement operators are provided?
- Write a program that reads in the number
of symbols in the side of a square, then prints a solid square of that size
using asterisks. Your program should work for squares of all sizes
between 1 and 20.
Modify the square program to print a hollow square instead of a solid square.