answersLogoWhite

0


Best Answer



Executing a segment of a program repeatedly by introducing a counter and later testing it using the if statement.

A sequence of statements are executed until some conditions for termination of the loop are satisfied.

A Program loop consists of two segments:
1.Body of the loop
2. Control Statement


Depending on the position of the control statement in the loop, a control strcture may be classifies either as the 2:

  1. Entry Controlled Loop
  2. Exit Controlled Loop
1.Entry Control Loop-(Pre Test Loop)
The control conditions are tested before the start of the loop execution.
If the conditions are not satisfied , then the body of the loop will not be executed.]
eg:
While Loop

2.Exit Control Loop-(Post Test loop)
The Test is performed at the end of the body of the loop and there fore the body is executed unconditionally for the first time.
eg:
Do-While



while loop
for loop
do-while loop
User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Definition of loop and its types and programs in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a while statement in turbo c plus plus?

A while statement is one type of looping statement. by which we can start a loop in our programs. while loop is precondition checking statement, because it first check its condition then loop will go to its body part. EX. while(i>0) { //body part } here when i will >0 then it will check it body part and execute it and display result.


Is for loop is faster than while loop in turbo c plus plus compiler?

No, why did you think so?


What is CPU usage small programm c plus plus?

Example: int main (void) { LOOP: goto LOOP; }


Does 'for loop' works in C plus plus?

In C++, a for loop is structured as follows: for( int index = 0; index < 10; ++i ) { //do something }


Example of flowchart of while loop in c plus plus?

kk


C plus plus file processing that will input 12 integers?

#include<iostream> #include<vector> int main() { std::vector<int> integers (12); for (size_t loop=0; loop<integers.size(); ++loop) cin >> integers[loop]; }


How do you convert meters to centimeters in c plus plus using the for loop construct?

It is unnecessary to use a for loop to convert meters to centimeters. Just multiply by 0.01.


What is an infinite loop in c plus plus?

An infinite loop is one sequence of commands that just repeats over and over again forever. When it comes to creating an infinite loop you can use the: for do while and do statements. using the keywords 'true'


How do you alternate the input numbers using for loop in c plus plus?

Input a variable.


How do you import a whole c plus plus class from a dynamic library?

You do not import classes. Classes are the definition of a type, and if you link to a library then all of its types are made available to your program. All you have to do is instantiate objects from those types: thus there is nothing to import.


C plus plus what do you do if im stuck in an infinite loop?

There are three ways out of a loop.1. Satisfy the loop ending condition2. Execute a break statement3. Terminate the programPerhaps you are not changing the value of the variable that is used in the loop ending condition. Perhaps you are using a variable, such as an unsigned int, decrementing it, and expecting it to go negative. Suggest you run the program in a debuger and step through the loop.


What are the application of c plus plus?

Writing programs in it.