C++ While Loop example


SUBMITTED BY: Guest

DATE: Oct. 12, 2013, 10 p.m.

FORMAT: C++

SIZE: 296 Bytes

HITS: 1126

  1. #include <iostream>
  2. using std::cout;
  3. int main()
  4. {
  5. int a = 0;
  6. while (a != 11) //While a does not equal 11
  7. {
  8. a++; //add 1 to a
  9. cout << a << "\n"; //print a and add newline
  10. }
  11. cout<<"The loop has ended";
  12. return 0;
  13. }

comments powered by Disqus