OOP CPP Programming language by Nadir Nadeem: Part-3
Table of Contents
Loop:
- Repetition is called loop
Loop statements:
- for()
- while()
- do-while
Loop requirement:
- Starting position(sp)
- Ending position (Condition)(ep)
- Jump (inc/dec)
1:- for loop
Syntax:
- For(sp; ep; inc/dec){
- Loop body
- }
Example:
Example:
Example: more than one increment (+=)
Ass#23 write number in brackets
(1):- Pakistan
(2):- Pakistan
Ass#24: standard table
Enter table value:= 3
1 * 3 = 3
2 * 3 = 6
3*3=9
10*3= 30
Ass#25: table with input end value
Enter table value:= 3
Enter end value:= 3
1 * 3 = 3
2*3=6
3*3=9
Ass#25: table with input end not more than 25
Enter table value:= 3
Enter end value:= 3
1 * 3 = 3
2*3=6
3*3=9
Ass#26: print text to required number
Enter your text:= Ali
How many value you want to write it:= 100
Ass#27: draw rectangle with *
************************************
* *
* *
************************************
Infinite loop
Syntax:
- for(;;){
- Loop body
- }
Example:
Example: infinite loop with condition
Keyword related with loop
- break
- continue
example:
2:- while() loop
Syntax:
Sp;
while(ep){
loop body
inc/dec
}
Example:
While() infinite
Syntax:
While(True){
Loop body
}
Example:
Example:
3:- do-while:
Syntax:
do{
loop body
inc/dec
} while(ep);
Example:
23,24,25,26,27 with while and do while
Last assè 36
Tags:
- for
- while
- do-while
- nested loops
- loop control statements
- break
- continue
- loop termination
- loop iteration
- loop variable
- loop condition
- loop initialization
- loop body
- loop structure
- loop syntax
- loop patterns
- loop examples
- loop performance
- loop optimization
- loop efficiency
- loop traversal
- loop manipulation
- loop iteration techniques
- loop control flow
- loop nesting
- loop iteration strategies
- loop design
- loop implementation
- loop execution
- loop indexing
- loop increment
- loop decrement
- loop iteration order
- loop iteration direction
- loop iteration control
- loop iteration conditions
- loop iteration variables
- loop iteration logic
- loop iteration patterns
- loop iteration management
- loop iteration best practices
- loop iteration tips
- loop iteration tricks
- loop iteration pitfalls
- loop iteration errors
- loop iteration debugging
- loop iteration troubleshooting
- loop iteration guidance
- loop iteration tutorials
- loop iteration resources.
- loop
- loops
- loop in cpp
- loop in c/c++
Related Posts
Leave a Reply
You need to login to write a comment!
Popular Posts
-
Khewra Mine Salt
28.12.2023 0 Comments -
Gus's Fried Chicken
27.12.2023 0 Comments -
Magic Spoon Cereal Review
28.10.2023 0 Comments -
free software download websites for pc
21.09.2023 0 Comments -
Egyptian Perfumery: Perfume History in Egypt
03.04.2024 0 Comments -
Perfume History: Perfume: Cologne: Scent: Fragrance
02.04.2024 0 Comments
Categories
- AUTO(11)
- HEALTH(83)
- TECH(10)
- SCIENCE(0)
- SOCIAL MEDIA (0)
- PRESS RELEASES(0)
- TESTIMONIALS (References)(6)
- BIO(1)
- SPORTS (9)
- EARNING ONLINE(0)
- ARCHITECTURE(1)
- IT(51)
- Accessories(3)
- News(15)
- Pet(13)
- Programming (5)
- Shopping (15)
- Visiting Place (13)
- Foods & Candies(8)
- Style and Fashion (3)
- Geography (1)
- Personalities(2)