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

String, Write a program that takes 3 small letters as input and sort them a...

Write a program that takes 3 small letters as input and sort them according to their ASCII value.

Define meaning of call by reference - computer programming, Define the Mean...

Define the Meaning of Call by reference? In "call-by- reference", as an alternative of passing the value of a variable, the location number (or the address) of the variable is

Loop, Write a program that writes your name on the monitor ten times. Write...

Write a program that writes your name on the monitor ten times. Write this program three times, once with each looping method.

Functions, please help me get all the inbuilt functions in c++

please help me get all the inbuilt functions in c++

#calculate percentge, #write a multilevel c++ program to take marks of 3 su...

#write a multilevel c++ program to take marks of 3 subjects and calculate percentage and display it

How to use turbo c, Sir i want to know all the basic knowledge of turbo c.

Sir i want to know all the basic knowledge of turbo c.

Main program to test the basic operations, The Main program is slightly mor...

The Main program is slightly more complicated and you need to think about the I/O process. First of all, for most applications you do not call the low level routines GetChar and P

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