Difference between revisions of "CPP/Loops/While"

From ProgrammingExamples
< CPP
Jump to: navigation, search
(dNxKo7 <a href="http://bucnqftefvan.com/">bucnqftefvan</a>, [url=http://pbugbdjicgdf.com/]pbugbdjicgdf[/url], [link=http://hdtaknutslvj.com/]hdtaknutslvj[/link], http://nauatiuwmypj.com/)
 
(13 intermediate revisions by 9 users not shown)
Line 1: Line 1:
dNxKo7  <a href="http://bucnqftefvan.com/">bucnqftefvan</a>, [url=http://pbugbdjicgdf.com/]pbugbdjicgdf[/url], [link=http://hdtaknutslvj.com/]hdtaknutslvj[/link], http://nauatiuwmypj.com/
+
<source lang="cpp">
 +
#include <iostream>
 +
using namespace std;
 +
 +
int main(){
 +
 +
const int END = 0;
 +
int input = -1;
 +
 +
while(input != END){
 +
  cin >> input;
 +
  cout << input * 2 << endl;
 +
}
 +
 +
return 0;
 +
}
 +
</source>

Latest revision as of 11:12, 20 September 2011

#include <iostream>
using namespace std;
 
int main(){
 
 const int END = 0;
 int input = -1;
 
 while(input != END){
   cin >> input;
   cout << input * 2 << endl;
 }
 
 return 0;
}