Explain the continue statement, C/C++ Programming

Assignment Help:

The continue statement

The continue statement causes the next iteration of the enclosing loop to start. When this is encountered in the loop , the rest of the statements in the loop are leave out and control passes to the condition.

Let us see an example that accepts a variable amount of numbers from the keyboard and prints the sum of only positive numbers.

e.g.

void main()

 {

  int num, total = 0;

 

do

 {

cout << " enter 0 to quit ";

cin >> num;                        // equivalent to scanf()

if(num == 0)

break;

if(num < 0)

continue;

total+=num;

 }

while(1);

cout << total;

 }

 


Related Discussions:- Explain the continue statement

Storing street addresses with doubly linked lists, Write a C++ program with...

Write a C++ program with header and source files to store street addresses using the Doubly Linked List ADT. Modify the Node class from Lab Assignment 3 so that it becomes a node i

Tell what the derived class inherits or doesn''t inherit?, Tell what the de...

Tell what the derived class inherits or doesn't inherit? A: Inherits: - All data member defined in the parent class (even though such members might not always be accessible

Vision based simultaneous mapping and localization, Project Description: ...

Project Description: Design and prepare software that can navigate a mobile robot using SLAM technique using vision sensor (camera). Skills required are C Programming, Engine

Area under curve, Write a program to find the area under the curve y = f(x)...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Application for tag in the forest game, Your program should use the Free Pa...

Your program should use the Free Pascal compiler or the Lazarus IDE described in CSC 540. When you hand in your assignment to the digital dropbox, it should be a .PAS file, not zip

Rules of inheritance, Rules of Inheritance: Private members are not...

Rules of Inheritance: Private members are not inherited; the members can be accessed only within its class. It cannot be used through the object. Protected members are

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd