C ++, continue

/*
C ++, continue to use
Author: Pirates of the one you
*/
#include<iostream>
using namespace std;
int main()
{
    int value;
    int i;
    int sum=0;
    cout<<"input  value"<<endl;
    for(i=0;i<4;i++)
    {
        cin>>value;
        if(value<0)
        {
            cout<<"waring:resume load,value>0"<<endl;
            i--; 
            continue;
            /*
            Skip continue this cycle, back to the loop condition test portion,
            Resumes execution cycle.
            */
        }
        sum+=value;
    }
    /*
    if(value==1)
    {
        cout<<"value=";
        cout<<value<<endl;
    }
    */
    cout<<"sum=";
    cout<<sum<<endl;
}

// embedded c51 language can be used in the library header files stdio.h stdlib.h string.h

Guess you like

Origin www.cnblogs.com/qqfoxmail/p/11068528.html