Here's my first C++ program in a few years:
Code:
#include <iostream>
using namespace std ;
int main()
{
int level = 1;
char suffix = '\0'; //Empty string.
for (int counter=1;counter<11;counter++) {
cout << counter << suffix;
suffix = ' ';
if ((int)((level*level + level)/2) == counter) {
cout << endl;
level++;
}
}
return 0;
} Tested on Visual C++ 2005.