unconditonally transfer program control within a function
example:
#include <iostream>
using namespace std;
int sm = 0;
int main()
{
while (true) {
int n;
cout << "Input a number: ";
cin >> n;
if (n < 0) {
break;
} else sm += n;
}
cout << "The sum is: " << sm << '\n';
}
Comments
Leave a comment