Check out the Forum area for beginners, intermediate, or advanced for free C++ source code examples. Also, there is source code posted throughout the rest of this website, check the pages for the respected language.
List of forum topics: Forum Topics
Become a member, it's free, registration is here: Registration
For a live feed that is parsed into an HTML page: New Posts (HTML)
For a live feed that you can save in your browser: New Posts (RSS)
Other C++ source code examples - Check the C++ source code
examples page for: for
(inFile and outFile), arrays, switch
control structures, if
, else if
statements, functions(), and more. Also, other language source code will be uploaded including JAVA application examples.
C++ Program: While loop counter
Compiler (Visual Studio) showing C++ Source Code:
// While loop.
using namespace std;
int num = 1; // Initialize counter starting at 1.
while (num <= 7) // Loop - number controls how many times.
cout << num; // Show the number as it increments.
num++; // Increment by adding 1 each iteration.
cout << " - Hello world!\n";
cout << "\n";
1 - Hello world!
2 - Hello world!
3 - Hello world!
4 - Hello world!
5 - Hello world!
6 - Hello world!
7 - Hello world!
Press any key to continue . . .
The above source code is C++, using a while loop
Here is the Source Code